The S&P 500 ended 0.5 percent higher after falling more than 1 percent.
The Nasdaq composite rose 1.1 percent. At its low, it fell as much as 1.3 percent.
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.
"Clearly, the environment has changed dramatically since the beginning of the year," said Adam Sarhan, CEO of 50 Park Investments. "Fundamentally, you have more bearish dominoes falling."
The tariffs announcement was widely condemned, including by European Commission President Jean-Claude Juncker, who said it "can only aggravate matters." Consequently, markets overseas fell sharply on Friday. The German Dax dropped 2.3 percent, while the Stoxx 600 index— which tracks a broad swath of European stocks — pulled back 2.1 percent.
But Trump stuck to his guns on Friday, tweeting: "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."
In corporate news, Foot Locker shares dropped 12.7 percent after the company reported a bigger-than-expected decline in same-store sales for the previous quarter. Foot Locker's same-store sales fell 3.7 percent, while analysts polled by Reuters expected a decrease of 2.5 percent.
Meanwhile, J.C. Penney's stock fell 5.4 percent after reporting weaker-than-expected revenue and same-store sales.