Stocks rose on Monday, erasing earlier losses, as worries about a potential trade war waned.

The Dow Jones industrial average closed 336.70 points higher at 24,874.76 after dropping as much as 150 points. Caterpillar was the biggest contributor of gains to the Dow, rising 3.2 percent.

The rose 1.1 percent to 2,720.94 after briefly trading lower, with utilities as the best-performing sector. Harley-Davidson, a closely watched stock amid the tariff news, rose 2.4 percent. The Nasdaq composite advanced 1 percent to close at 7,330.70.

"Seeing Caterpillar and Harley-Davidson trade higher tells me that traders think this will end diplomatically," said Quincy Krosby, chief market strategist at Prudential Financial. She also noted that the President Donald Trump's comments on NAFTA showed "flexibility" on his part.

Trump appeared to be opening the door for negotiations on tariffs. In a series of tweets Monday morning, Trump said: "Tariffs on Steel and Aluminum will only come off if new & fair NAFTA agreement is signed," adding that "Mexico must do much more on stopping drugs from pouring into the U.S. They have not done what needs to be done."

Trump tweet

Tweet

Also, House Speaker Paul Ryan said he was "extremely worried" about Trump's trade plan. Congressional leaders will not rule out potential action if Trump decides to move forward with his tariff plan.

Trump announced last week the U.S. will implement a 25 percent tariff on steel imports and a 10 percent tariff on aluminum imports. The news sparked fears of a potential global trade war as world leaders condemned the announcement. In response to the U.S. tariffs, the European Union proposed tariffs on Harley-Davidson bikes and other U.S. products.

"We're in an uncertainty zone with investors asking: 'What's going on?' with regards to protectionism and trade," said Mike Bailey, director of research at FBB Capital Partners. "The first instinct seems to be risk-off as people buy into the bond proxies like utilities."

Equities fell following Trump's announcement, with the Dow closing 420 points lower on Thursday. The S&P 500 and Nasdaq also closed lower that day.