BRUSSELS — The European Union and Japan have agreed "in principle" on a free trade deal that will affect an overwhelming majority of commerce between the two economic giants and will be officially endorsed at a summit of their leaders Thursday.

EU Council President Donald Tusk and Japanese Prime Minister Abe will meet Thursday and will be able to shake hands on the landmark deal, which took four years of negotiations.

EU Trade Commissioner Cecilia Malmstrom said in a Tweet that "We've reached political agreement" and "now recommend to leaders to confirm this" at their short summit on the eve of the G-20 meeting of top leaders in Hamburg, Germany.

A senior EU official, who spoke only on condition of anonymity ahead of Thursday's summit, said that the deal with the Japanese "means we have agreed on almost everything of importance to either side."

Now, legal scrubbing and translations are expected to take several months before the agreement can be formally completed and put to approval to national authorities in the EU and Japan.

A deal would require tweaks to Japan's protections for its dairy farmers, whose home market is protected by tariffs of up to 40 percent on processed cheese.

Both Japan and the EU have a tradition of protecting their politically powerful farm sectors, and dairy products are an especially sensitive issue for the EU, which represents half the global market.

The EU official said that the EU food agriculture sector was expected to be "the big winner" out of the negotiations.