"The main focus is on tariffs," said Peter Cardillo, chief market economist at First Standard Financial. "The question for the market is what do these tariffs mean in terms of their economic impact."

The closed 0.45 percent higher at 2,738.97, with utilities and consumer staples as the best-performing sector. The Dow Jones industrial average ended 93.85 points higher at 24,895.21. The Nasdaq composite rose 0.4 percent to 7,427.95. The major averages alternated between gains and losses throughout the session.

Stocks closed higher on Thursday after President Donald Trump implemented steel and aluminum import tariffs that excluded Canada and Mexico, two key U.S. trade partners.

Traders work on the floor of the New York Stock Exchange.

The tariffs signed by Trump will take effect in 15 days and will exempt Canada and Mexico indefinitely. They also leave the door open for other countries to argue why they should also be exempt. The moves slap 10 percent and 25 percent charges on aluminum and steel imports, respectively.

"A strong steel and aluminum industry are vital to our national security," Trump said on Thursday. "You don't have steel, you don't have a country."

Shares of U.S. Steel and Nucor fell 2.9 percent and 2.7 percent, respectively, while Century Aluminum pulled back 7..5 percent. Boeing, a large metals user, saw its shares climb 0.5 percent.

Trump said last week he wanted to implement the tariffs without exempting certain countries like Canada and Mexico. The announcement last week sparked fears that a trade war could take place in the near future.

The move was also followed by the resignation of Gary Cohn, Trump's top economic advisor. Cohn opposed the implementation of tariffs and his departure sent ripples across financial markets.

"The back-and-forth you're seeing in the market is investors trying to determine whether the tariffs will go through," said Brent Schutte, chief investment strategist at Northwestern Mutual Wealth Management. "I think people are looking at the tariffs through the lens of what happened in the 1930s when we implemented tariffs. But the backdrop is much more different now than it was back then."

In economic news, weekly jobless claims increased by 21,000 to 231,000 last week, bouncing back from a 48-year low.

Investors also looked ahead to the release of the Bureau of Labor Statistics' monthly jobs report. Economists polled by Reuters expect the economy to have added 200,000 jobs last month. But most investors will be looking at the average hourly earnings growth after January's print helped spark the most recent stock-market correction.

"Last month's very strong average hourly earnings was a blip in the radar," said Andrew Chamberlain, chief economist at Glassdoor. "We're seeing wage growth, just at a slower pace."

In corporate news, Cigna announced it plans to buy Express Scripts for $67 billion in a cash-and-stock deal. Cigna would find a new partner in Express Scripts, after antitrust regulators last year denied a Cigna and Anthem combination as anti-competitive. Express Scripts shares rose more than 8 percent on the news.

—CNBC's Mike Calia contributed to this report