U.S. stocks closed well off session lows on Friday, helped by a sharp rise in health care shares.

The ended 0.5 percent higher at 2,691.25 after falling more than 1 percent. Health care sector was the best-performing sector, gaining 1 percent. Shares of Universal Health Services and Perrigo were among the best-performers in the index.

The Nasdaq composite rose 1.1 percent to 7,257.87 as the iShares Nasdaq Biotechnology ETF (IBB) advanced 2.4 percent. At its low, the Nasdaq fell as much as 1.3 percent.

The Dow Jones industrial average closed 70.92 points lower at 24,538.06 after falling as much as 391 points. Johnson & Johnson and Merck were among one of the best-performing stocks in the index, rising 1.2 percent each.

"When there's an opportunity to buy on the dip, people are taking it," said Phil Blancato, CEO of Ladenburg Thalmann Asset Management. "Economically, you're healthy ... and earnings continue to be strong."

But despite trading off their lows, the major averages posted a weekly loss for the first time in three weeks. For the week, the Dow, S&P 500 and Nasdaq fell 3.1 percent, 2 percent and 1.1 percent respectively.

"We saw no volatility for 18 months until the first week of February," said Rich Guerrini, CEO of PNC Investments. "We were all sort of numb to it. All of the sudden, we have to get used to volatility again."

Stocks traded sharply lower earlier in the session on fears that President Donald Trump's announced tariffs on steel and aluminum could spark a trade war. Domestically-oriented companies in industries like health care would be among the least affected by a trade war.

Trump made the announcement on Thursday, saying the U.S. will implement a 25 percent tariff on steel imports and a 10 percent tariff on aluminum imports next week. The news sent stocks reeling, with the Dow closing 420 points lower, while the S&P 500 and Nasdaq dropped more than 1 percent. It also raised concern that other countries may implement retaliatory tariffs on U.S. exports.

"The tariff announcement that was made is being considered to be a lot more serious than people were expecting," said Tom Martin, senior portfolio manager at Globalt. "Many people thought this would be more targeted. Instead, it's like hitting something with a blunt instrument."

Shares of steel and aluminum users like General Motors and Boeing fell 1 percent and 1.4 percent on Friday, extending Thursday's losses of 4 percent and 3.5 percent, respectively. Harley-Davidson also slipped 2 percent. Meanwhile, U.S. Steel fell 1.4 percent after posting strong gains in the previous session.