BIARRITZ, France (Reuters) - The United States and Japan agreed in principle on Sunday to core elements of a trade deal that U.S. President Donald Trump and Prime Minister Shinzo Abe said they hoped to sign in New York next month.

The agreement, if finalized, would cool a trade dispute between the two allies just as a trade war between the United States and China escalates.

U.S. Trade Representative Robert Lighthizer said the deal covered agriculture, industrial tariffs and digital trade. Auto tariffs would remain unchanged.

Trump said Japan had agreed to buy excess U.S. corn that is burdening farmers as a result of the tariff dispute between Washington and Beijing. Abe referred to a potential purchase of the corn and said it would be handled by the private sector.

“It’s a very big transaction, and we’ve agreed in principle. It’s billions and billions of dollars. Tremendous for the farmers,” Trump told reporters about the deal during a joint announcement with Abe at the G7 meeting in France.

The Japanese leader said more work remained, but he expressed optimism that it would be finished by the time of the United Nations General Assembly next month.

“We still have some remaining work that has to be done at the working level, namely finalizing the wording of the trade agreement and also finalizing the content of the agreement itself,” he said, through an interpreter.

U.S. President Donald Trump and Japan's Prime Minister Shinzo Abe shake hands as they attend a bilateral meeting during the G7 summit in Biarritz, France, August 25, 2019. REUTERS/Carlos Barria

“But we would like to make sure that our teams ... accelerate the remaining work for us to achieve this goal of realizing the signing of the agreement on the margins of the U.N. General Assembly at the end of September.”

Lighthizer noted that Japan imports about $14 billion worth of U.S. agricultural products and said the agreement would open up markets to over $7 billion of such products. He said beef, pork, wheat, dairy products, wine, and ethanol would all benefit by the deal.

“It will lead to substantial reductions in tariffs and non-tariff barriers across the board,” he said. He did not go into detail about the industrial and e-commerce aspects of the deal.

Top 10 markets for U.S. agriculture products by value and volume -

Trump, who last week said he had ordered U.S. companies to start looking for alternatives to doing business in China, seemed to dismiss Abe’s emphasis that the Japanese private sector would handle the purchases of excess U.S. corn.

“The Japanese private sector listens to the Japanese public sector very strongly... It’s a little different than it is in our country perhaps,” Trump said.

Abe, meanwhile, seemed to want to hedge against Trump’s suggestion that the corn purchases were a done deal, but he said insect pests had affected some agricultural products in Japan, creating a need to buy certain products.

“We believe that there is a need for us to implement emergency support measures for the Japanese private sector to have the early purchase of the American corn,” he said. “So that’s why, against such backdrop, I do think that there is a possibility for us to cooperate to address this issue.”

Trump is eager to help out farmers who have been hurt by the trade dispute with China, particularly in political swing states that he needs to support him in his bid for re-election in 2020.