U.S. stocks closed higher on Tuesday, but Wall Street remained on edge over an ongoing debate over tariffs proposed by President Donald Trump.

The Dow Jones industrial average ended 9.36 points higher at 24,884.12 after briefly falling as much as 166 points. Earlier in the session, the Dow rose 120 points.

The rose 0.3 percent to 2,728.12 after falling as much as much as 0.4 percent. General Motors, a company that would be adversely affected by the tariffs, saw its shares rise 0.5 percent. The Nasdaq composite closed 0.6 percent higher at 7,372.01 as shares of Netflix and Amazon rose.

The major averages traded lower earlier in the session after Bloomberg News reported citing sources that Trump was convinced Cohn would leave the administration if the tariffs proposed by the president were implemented.

"If you have a high-profile person like Gary Cohn leaving, that starts to send things into a tailspin in government and the market is concerned about that," said Robert Pavlik, chief investment strategist at SlateStone Wealth. "The Cohn news is causing investors to take a wait-and-see approach."

Cohn, a former Goldman Sachs executive, was a champion of the tax cuts implemented by the Trump administration last year.

"If [Cohn] leaves it's a big deal because that means the 'America First' people are taking over," said Larry McDonald, head of the U.S. macro strategies at ACG Analytics and editor of The Bear Traps Report.

CNBC's Jim Cramer tweeted about the pullback in stocks, calling it the "Cohn sell off."

Tweet

But stocks recovered in early afternoon trading, after Sen. David Perdue, R-GA, a Trump ally, said the president was open to changes on tariffs.

Trump announced last week the U.S. would be imposing new tariffs on aluminum and steel, before going onto threaten European carmakers with a tax on imports if the European Union retaliated over the U.S. administration's tariff plans.

House Speaker Paul Ryan said Monday he was "extremely worried" about President Donald Trump's trade plan. But Ryan backtracked on Tuesday, calling for targeted tariffs on metals rather than blanket tariffs. Treasury Secretary Steven Mnuchin also backed implementing tariffs.

"The market is still trying to sort out the tariffs issue," said Jennifer Ellison, principal at Bingham, Osborn & Scarborough. "That has serious economic ramifications."

The major averages rallied at the open after North Korea said there was no need to keep its nuclear program as long as there was no military threat against it and the safety of its regime was secured, Chung Eui-yong, head of the South Korean presidential National Security Office, told a media briefing.

Stock futures jumped on the news, while the dollar traded lower to give commodities like oil and gold a boost.

In corporate news, Nordstrom rejected an offer from the Nordstrom family to take the company private for $50 per share. The Nordstrom family has been working to take the company private since last year.

Harley-Davidson said retaliatory tariffs by other countries on its motorcycles would have a "significant impact" on the company's sales. The company made the statement after European Commission President Jean-Claude Juncker said last week the European Union would impose tariffs on Harley's motorbikes if Trump moved forward with his tariffs. Harley-Davidson shares fell 2 percent.

—Reuters contributed to this report.