Thirty years ago, as Donald Trump gave what is widely considered to be the first campaign speech of his career, he criticized one country above all for cheating the United States in trade: Japan.

On Thursday, Japan took on the mantle of the global rules-based trading system, as it sidestepped a failing trade agreement with the United States to forge a historic new pact with the European Union.

Leaders from Japan and the European Union on Thursday announced their agreement in principle on the broad strokes of a trade deal that will cover nearly 30 percent of the global economy, 10 percent of the world’s population and 40 percent of global trade.

The deal crafts a trading bloc roughly the same size as that established by the North American Free Trade Agreement, a 1994 deal between the United States, Mexico and Canada.

Coming on the eve of the Group of 20 meeting of global leaders in Hamburg, Germany, the announcement appeared to be a calculated rebuke of both the United States, which has spurned global trade agreements in favor of more protectionist policies under President Trump, and Great Britain, which voted to leave the European Union last year.

Shinzo Abe, the prime minister of Japan, greeted the announcement as “the birth of the world’s largest free advanced industrialized economic zone.”

“Japan and the European Union will hoist the flag of free trade high amidst protectionist trends,” Abe said in a press conference Thursday.

Jean-Claude Juncker, the president of the European Commission, said the deal “shows that closing ourselves off from the world is not good for business, nor for the global economy, nor for workers. As far as we are concerned, there is no protection in protectionism.”

While concrete details are still being ironed out, information released by Japan suggested that the deal will lower trade barriers for a sweeping array of products, including a 10 percent European tariff on Japanese car brands like Toyota and Honda and an up to 14 percent tariff on electrical machinery.

In a press conference on Thursday, Juncker said that more than 90 percent of European exports to Japan will have freer terms of trade under the deal, including European wine, leather, shoes and dairy products.

The deal will be a heavy blow to American producers of these goods, by making U.S.-made goods relatively more expensive and less competitive in the major markets of Japan and Europe.

The deal also contains the firmer protections for data privacy that the European Union has long advocated. Matthew Goodman of the Center for Strategic and International Studies said these provisions run counter to the interest of U.S. technology companies and other multinationals, which have argued in past trade negotiations for the ability to freely move and store data around the world.

Talks over the deal have stretched over more than four years, in part because Japan was more focused on the Trans-Pacific Partnership, a 12-country trade deal that included the United States. But after President Trump’s election last year, negotiations between Japan and Europe accelerated, as the countries saw that the United States might take a new posture on trade, said Goodman.

On his third day in office, President Trump officially withdrew the United States from negotiations for the TPP. It was a blow to Abe and his party, who had invested much political capital in pushing the Pacific agreement forward.

On Thursday, Abe said that he would continue to push ahead with TPP negotiations without the United States in meetings with the remaining 11 countries next week, and that he would continue to try to persuade Trump of the TPP’s importance.

Europe and Japan have only agreed to their trade deal “in principle,” meaning they concur on its broad outlines. As such, the deal could still founder due to internal political opposition. At the press conference, Donald Tusk, the president of the European Union, said the countries were aiming to bring the deal into force in early 2019.