Gains by technology companies helped snap a three-day losing streak for U.S. stocks Friday, though the market ended with its worst weekly loss since March.
The modest rebound came at the end of a turbulent week on Wall Street as escalating tensions between the U.S. and North Korea rattled global markets.
In the first four days of the week, the Standard & Poor's 500 index swung from marking its latest record high to posting its biggest single-day drop in nearly three months.
The negative headlines provided many investors with an opportunity to pocket some of their recent gains following a string of record highs fueled by strong corporate earnings.
"It's been a bit of a roller coaster this week, with all the rhetoric between the U.S. and North Korea," said Jeff Kravetz, regional investment strategist at U.S. Bank Wealth Management. "That did temporarily shake investors' complacency, but we think markets are ready to move higher in the back half of the year, and earnings and economic data are going to drive that."
On Friday, the S&P 500 rose 3.11 points, or 0.1%, to 2,441.32 — the day after the index's biggest drop since mid-May. The Dow Jones industrial average rose 14.31 points, or 0.1%, to 21,858.32. The tech-heavy Nasdaq climbed 39.68 points, or 0.6%, to 6,256.56. The Russell 2000 index of smaller-company stocks ticked up 1.69 points, or 0.1%, to 1,374.23.
The recovery fit a recent pattern of investors using dips to put more money in stocks.
Despite this week's decline, the major indexes are in positive territory so far this year, led by the Nasdaq, which is up 16.2%. The S&P 500 is up 9%, and the Dow is up 10.6%.
"If you strip away what's going on in North Korea, and if you strip away what's going on in Washington, which are things that are tougher to predict," Kravetz said, "the economy, the global recovery, earnings, it all paints a very positive picture for the rest of the year."
Tensions between the U.S. and North Korea continued to simmer Friday. In a tweet, President Trump warned of military action "should North Korea act unwisely," saying the U.S. is "locked and loaded." Earlier in the week, Trump said the U.S. would unleash "fire and fury" on North Korea if it continued to threaten the U.S.
North Korea had announced a detailed plan to launch a salvo of ballistic missiles toward the U.S. Pacific territory of Guam, a major military hub and home to U.S. bombers.
Still, there were fewer signs of anxiousness in the markets Friday. Bond and gold prices, traditional havens for nervous investors, were little changed, and the VIX, a measure of how much volatility investors expect in stocks, fell 3.3% following a 44.4% jump the day before. It's still the highest it has been since May.
Investors also drew some encouragement from new government data showing U.S. inflation at the consumer level inched higher last month. July's 0.1% increase in consumer prices suggests that the Federal Reserve may be less likely to raise interest rates next month.
Traders sold off financial stocks amid speculation that the Fed will decide to hold off on raising interest rates. Higher interest rates can help boost banks' revenue from loans. Regions Financial fell 1.6% to $14.07.
Technology companies, which suffered the brunt of the selling Thursday, were back in the lead Friday. Lam Research Corp. climbed 3.2% to $154.26.
Seagate Technology rose 2.3% to $32.29 after investor ValueAct disclosed that it had acquired a 7.2% stake in the digital storage company.
Nvidia, however, dropped 5.3% to $155.96. The maker of graphics chips posted earnings that beat expectations, but investors were concerned about slowing growth in its data center business.
J.C. Penney sank 16.6% to $3.93 after the struggling department store chain reported quarterly results that fell short of Wall Street's expectations. The company also said sales at its established stores declined for the fourth straight quarter.
Trade Desk jumped 8.8% to $54.45 after the Ventura digital-advertising platform operator's earnings and revenue came in well ahead of expectations.
Bond prices rose. The yield on the 10-year Treasury note slipped to 2.19% from 2.20%.
Benchmark U.S. crude rose 23 cents to settle at $48.82 a barrel on the New York Mercantile Exchange. Brent crude, used to price international oils, rose 20 cents to $52.10 a barrel in London.
In other energy futures trading, wholesale gasoline rose 1 cent to $1.61 a gallon. Heating oil was little changed at $1.63 a gallon. Natural gas stayed at $2.98 per 1,000 cubic feet.
Gold rose $3.90 to settle at $1,294 an ounce. Silver rose 1 cent to $17.07 an ounce. Copper rose 1 cent to $2.91 a pound.
The dollar slipped to 109.04 yen from 109.26. The euro rose to $1.1812 from $1.1774.
Major indexes in Europe closed mostly lower. Germany's DAX was flat, while France's CAC 40 and Britain's FTSE 100 both fell 1.1%.
In Asia, several indexes closed lower. South Korea's Kospi lost 1.7%, and Hong Kong's Hang Seng slid 2%. The market in Japan was closed for a holiday. Australia's S&P/ASX 200 dropped 1.2%.
2:40 p.m.: This article was updated with closing prices, context and analyst comment.
1:25 p.m.: This article was updated with the close of markets.
7:50 a.m.: This article was updated to include more recent market information.