U.S. equities edged higher on Friday as investors weighed tensions between the U.S. and North Korea heading into the weekend.
The gained 0.13 percent to end at 2,441.32 with information technology rising 0.75 percent to lead advancers. The index posted its second-worst weekly performance of the year. It fell 1.43 percent for the week, the most since the week of March 24.
The Dow Jones industrial average closed 14.31 points higher at 21,858.32 after briefly dipping into negatively territory, with Apple contributing the most gains. The Dow also closed out its second-worst weekly performance of the year.
The Nasdaq composite outperformed, rising 0.64 percent to 6,256.56 as large-cap tech stocks rebounded. The index posted its third-worst weekly performance of the year.
Stocks were coming off their worst session since May as tensions between the U.S. and North Korea linger.
In the latest developments between the two countries' war of words, President Donald Trump tweeted another stark warning to North Korea on Friday.
The tweet came a day after Trump said his previous warning to North Korea that it would face "fire and fury" may not have been "tough enough."
"This is a very fluid environment. Typically you would see buyers coming in off a sell-off … you could see some buying on the dips," said Prudential Financial chief market strategist Quincy Krosby.
"We could see some zigging and zagging going into the weekend," Krosby said.
Gold futures for December delivery hit their highest level since June, rising $3.90 to settle at $1,294 per ounce.
Earlier stocks caught a bid after the Labor Department said the Consumer Price Index edged up 0.1 percent last month, versus expectations of a 0.2 percent gain. The index is a widely followed inflation metric.
"Because the numbers came in lower, the market saw that as an indication that the Fed won't raise rates in September," said Robert Pavlik, chief market strategist at Boston Private. "I'm not sure that the market believes that the Fed won't do anything to the balance sheet."
Market expectations for a December rate hike fell after the CPI data was released. Just 38 percent of investors expected the central bank to rates again at the end of the year, down from about 45 percent, according to the CME Group's FedWatch tool.
"With weak inflation, if not turning down, it will make it even more difficult for the Fed to do anything, between today's CPI and yesterday's PPI," said Baird Chief Investment Strategist Bruce Bittles. "Are you going to raise rates in this environment?"
The CBOE volatility index (VIX), widely considered the best gauge of fear in the market, hit its highest level since the presidential election before easing to 15.7.
"North Korea gets the headlines, but don't forget that we are closing the door on a very impressive earnings season," Ryan Detrick, senior market strategist at LPL Financial. "This will be the first back-to-back double digits earnings growth since late '11, but just as impressive has been this is a global recovery in earnings."
Before this week, U.S. stocks have been hitting record highs, boosted by mostly stronger-than-expected earnings.
Snap, however, did not beat expectations. The social media company posted a larger-than-expected loss and smaller-than-expected revenue, sending the stock down 14 percent.
J.C. Penney's stock also fell sharply Friday after the struggling retailer turned in a mixed second-quarter report that included a greater-than-expected loss in earnings. The stock fell nearly 17 percent.
Graphics chipmaker Nvidia saw its stock fall about 5 percent after reporting stronger-than-expected earnings. Though one of the best-performing stocks in the entire market, investors were disappointed by its slow growth in its unit that serves artificial intelligence applications.