After a wild session on Wednesday, stocks closed sharply higher as Wall Street erased massive losses earlier that came after China's announcement of new tariffs on U.S. goods sparked fears of a trade war.

The Dow Jones industrial average closed 230.94 points higher at 24,264.30, rallying more than 700 points from its session low. Microsoft and IBM were the best-performing stocks in the index.

The erased a 1.6 percent decline to finish the session 1.2 percent higher at 2,644.69, led by gains in consumer stocks. The broad index also closed back above its 200-day moving average, a key technical level. The Nasdaq composite closed 1.5 percent higher at 7,042.11 after plunging as much as 1.9 percent.

Stocks mounted their comeback as the White House tried to push back on the notion a trade war would breakout.

Larry Kudlow, Trump's chief economic advisor, told reporters: "He wants to solve this with the least amount of pain.... this is a growth action. I can't emphasize that enough."

"We have a very emotional tape," said Jeff Kilburg, CEO of KKM Financial. "When you have so much emotion, you're going to see some volatile moves."

"The emotional tape presents investors with a buying opportunity," he said.

Apple helped lead the comeback in the market, rising 1.9 percent. Chip stocks also rebounded, with Micron and Advanced Micro Devices climbing 3.6 percent and 2.3 percent, respectively.

Automakers Ford and General Motors rose 1.6 percent and 3 percent, respectively, after falling sharply earlier on Wednesday. But Boeing — a company that can be adversely impacted by a trade war — closed 1 percent lower. Deere also pulled back 2.9 percent.

The major averages hit their session highs after Bloomberg reported President Donald Trump may soften on a key NAFTA negotiation point.

China's Ministry of Commerce said the tariffs are designed to target up to $50 billion in U.S. products annually and would hit goods like soybeans and cars. The news increased worries a trade war may be brewing between the U.S. and China.