President Donald Trump on Wednesday said he struck a preliminary deal with European Union officials to avoid a full-blown trade war, causing stocks to soar.

The EU will import more American soybeans and natural gas, adjust regulations to help medical devices be traded more easily, and both sides will decrease industrial tariffs.

The EU had threatened to impose retaliatory tariffs on $20 billion of US goods if the talks failed.

President Donald Trump on Wednesday said he struck a preliminary deal with European Commission President Jean-Claude Juncker to ease trade tensions and avoid a full-blown trade war with the European Union.

"This was a very big day for free and fair trade," Trump said during a hastily scheduled joint appearance in the White House Rose Garden with Juncker, hailing a "new phase" of trade relations with the EU.

The Dow Jones Industrial Average spiked by almost 140 points after the news broke, ending the day nearly 0.7% higher.

The EU agreed to import more American soybeans and liquefied natural gas, Trump said. Both sides will work to decrease industrial tariffs and adjust regulations to allow US medical devices to be traded more easily in European markets. He said the two leaders were working towards a goal of "zero tariffs, zero barriers, and zero subsidies on non-auto industrial goods."

The sides will "hold off" on other tariffs while negotiations proceed, Juncker said, amid Trump's threat of new tariffs on cars and auto parts from the EU. The two leaders also agreed to work together on energy and intellectual property issues, as well as making reforms to the World Trade Organization, and creating a bilateral working group on trade issues to supplement the negotiations.

"We're starting these negotiations right now, but we very much know where its going," Trump said to reporters. "We also will resolve the steel and aluminum tariff issues, and we will resolve the retaliatory tariffs."

Thus far, Trump's administration has already enacted sweeping tariffs on US imports of steel, aluminum, washing machines, and solar-energy equipment while targeting China specifically with tariffs on an additional $34 billion worth of goods.

The EU, China, and Canada have hit billions of US goods with tariffs in response, causing the White House on Tuesday to propose $12 billion in emergency aid to farmers hurt by such retaliatory measures.

Trump's enthusiasm about Wednesday's trade negotiations are a significant change from remarks he made on Twitter just 24 hours earlier, when declared "tariffs are the greatest."

"Every time I see a weak politician asking to stop Trade talks or the use of Tariffs to counter unfair Tariffs, I wonder, what can they be thinking?" Trump wrote in a Wednesday morning tweet. "Are we just going to continue and let our farmers and country get ripped off? Lost $817 Billion on Trade last year. No weakness!"

But in the joint conference with Juncker, Trump seemed markedly more optimistic about the future of US-European trade relations. Before the meeting on Wednesday, the EU's trade commissioner, Cecilia Malmstrom, warned that if the negotiations fell through, the EU was ready to slap $20 billion-worth of US goods with more retaliatory tariffs, a measure which will be avoided, for now.

"We have identified a number of areas on which to work together," Juncker said at the joint conference. "We will hold off on further tariffs, and reevaluate existing tariffs on steel and aluminum. This was a good and constructive meeting."