President Trump's trade war threat drove the Dow lower for the second straight day.

The Dow fell as much as 391 points on Friday, but it recovered most of those losses and finished down 71. The Nasdaq and the S&P 500 both ended with modest gains after falling 1% earlier in the day.

The sell-off began Thursday after Trump announced that his administration would impose a 25% tariff on steel imports and a 10% tariff on aluminum. Trump has not said whether some countries would be excluded from the tariffs.

For the market, "this really could be something new and worse than we have seen so far," said Brad McMillan, chief investment officer at Commonwealth Financial Network.

Trump's plans caught investors off guard and raised fears about a tit-for-tat retaliation from China and other major US trading partners.

Canada, Germany, the European Union and Australia all denounced the move. The World Trade Organization is "clearly concerned," director general Roberto Azevedo said. "The potential for escalation is real."

On Friday, Trump elevated concerns about a full-blown trade fight even further by tweeting that "trade wars are good, and easy to win."

When a country (USA) is losing many billions of dollars on trade with virtually every country it does business with, trade wars are good, and easy to win. Example, when we are down $100 billion with a certain country and they get cute, don't trade anymore-we win big. It's easy! — Donald J. Trump (@realDonaldTrump) March 2, 2018

"Markets hate uncertainty and we still don't know exactly who and by how much these tariffs will impact trade," said Ryan Detrick, chief senior market strategist at LPL Financial.

Related: Germany and other allies are really, really angry about Trump's tariffs

Investors turned to domestically focused companies that are less sensitive to retaliatory tariffs, such as biotech and health care. Johnson & Johnson (JNJ), Merck (MRK) and Pfizer (PFE) were among the biggest winners of the day. The Russell 2000 index of smaller companies gained 1%.

"As the economic cycle ages, volatility is more normal, but the overall economic backdrop is still quite positive," Detrick said.

Corporate America has warned that tariffs will harm the economy and the market.

Costs could soar for American companies that rely on aluminum and steel produced overseas, such as auto and plane manufacturers and construction. Imports make up about a third of the 100 million tons of steel used by American businesses every year. More than 60% of the overall market for aluminum supply comes from imports, according to the Aluminum Association, citing 2017 data.

If the tariffs bring more expensive steel and aluminum, companies that rely on those materials may pass some of those costs to consumers. That raises the possibility inflation will creep up.

And if other countries decide to hit back with their own tariffs on US goods, export-dependent industries such as agriculture will become less competitive overseas.

Related: 'Trade wars are good?' Two words: Great. Depression.

On the other hand, McMillan said, if companies decide to eat most of those higher costs, their profit will take a hit, hurting their stock values.

Shares of Boeing (BA) dropped 1% and Caterpillar (CAT) lost 2% on Friday. Ford (F) gained 1%, but General Motors (GM) lost 1%.

The tariffs caused yields on U.S. bonds to fall on Thursday as investors sought a haven from volatile stocks. Yields and prices move in opposite directions. The 10-year Treasury was back up slightly Friday to 2.86%.

Domestic steel and aluminum manufacturers are the winners from Trump's tariff announcement.

U.S. Steel (X) and AK Steel (AKS) soared on Thursday 6% and 10%, respectively, on Thursday. U.S. Steel lost 1% on Friday, and AK Steel gained 1%.

McMillan attributed the slight drop for some steel companies to investors not reading too much into Trump's tweets.

"This has the potential to get worse, but there's a long way to go before we have a trade war," he said. "What Trump says and what he does are often two different things."

Welles Orr, a former assistant US Trade Representative under President George H.W. Bush and a trade consultant, said the steel and aluminum industries are not immune to global backlash.

"This might look and make you feel good at the outset," Orr said. "But in the long run, it's going to hit so many industries."

The tariffs also raise doubts about the future of NAFTA, Orr added. Trump has threatened to tear up the trade agreement with Canada and Mexico. The three countries are in their seventh round of talks.

—CNN's Matt Egan contributed to this report.

Correction: An earlier version of this article incorrectly stated the amount of aluminum used in the United States that is imported.