The Dow Jones Industrial Average .DJI rose 517.80 points, or 0.98%, to 53,277.01, the S&P 500 .SPX gained 33.21 points, or 0.43%, to 7,674.37 and the Nasdaq Composite .IXIC gained 113.29 points, or 0.44%, to 26,180.46.
For the week, the S&P 500 fell 1.43%, the Nasdaq declined 2.05%, and the Dow fell 0.85%. The Russell 2000 .RUT small-cap index fell 1.65% for its biggest drop since the week starting June 1.
Among the S&P 500's 11 major industry sectors, most advanced on Friday. Materials .SPLRCM outperformed with a 2.2% advance, followed by a 1.3% advance in healthcare and a 1% gain in financial stocks .
.SPXHC
.SPSY
Utilities .SPLRCU was the biggest laggard by far, finishing down 2.3% compared with a 0.2% drop for energy .SPNY, the next-biggest loser.
In individual stocks, Ross Stores ROST.O finished up 4.4% after the value retailer raised its annual profit forecasts and reported better-than-expected quarterly results.
Shares of retail investor platform Robinhood HOOD.O rallied 13.7%. Crypto exchange operator Coinbase Global COIN.O climbed 8.2% and bitcoin-hoarder Strategy MSTR.O added 6% as bitcoin BTC= advanced 6.4% and touched its highest levels since mid-May.
In the week ahead, investor attention will turn to quarterly results from AI chip leader Nvidia NVDA.O and software companies such as Intuit INTU.O, Salesforce CRM.N and CrowdStrike CRWD.O.
Next week's data releases include July's Personal Consumption Expenditures price index, which is the U.S. Federal Reserve's preferred inflation gauge. Tame July readings for consumer and producer prices had knocked down bets of an imminent central bank rate hike.
Investors are also waiting for Fed Chair Kevin Warsh's speech at the Jackson Hole symposium at the end of next week.
Advancing issues outnumbered decliners by a 1.68-to-1 ratio on the New York Stock Exchange, where there were 214 new highs and 118 new lows. On the Nasdaq, 3,186 stocks rose and 1,725 fell as advancing issues outnumbered decliners by a 1.85-to-1 ratio.
The S&P 500 posted 13 new 52-week highs and four new lows while the Nasdaq Composite recorded 91 new highs and 76 new lows.
On U.S. exchanges, 14.91 billion shares changed hands compared with the 16.62 billion average for the last 20 sessions, according to LSEG data.
Economic data and oil prices shape sentiment
After a seesaw trading week on Wall Street, Chris Zaccarelli, chief investment officer at Northlight Asset Management in Charlotte, North Carolina, said that Friday seemed calmer.
"In the middle of the week, equity investors were concerned yields could be on a one-way trip higher. With the Treasury Department announcement, investors aren't as worried any more," he said.
Also helping to ease investor worries was Friday's economic data, which showed that the strongest growth in the U.S. services sector in nearly two years powered a sharp acceleration in overall business activity in August. This offset a slowing of growth in a manufacturing sector that is being restrained by reduced stock building and supply disruptions from the Iran war.
Earlier, UBS Global Wealth Management raised its year-end target for the S&P 500 to 8,100, citing a stronger earnings outlook and robust corporate profit growth.
Adding to inflation concerns, however, oil futures settled higher for a sixth straight day, after U.S. President Donald Trump threatened economic sanctions on Iran's trading partners, raising expectations of tighter supply. For the week, Brent futures LCOc1 gained 6.39% while U.S. crude CLc1 rose 5.66%.
Stocks end higher Friday but lower for the week
The main U.S. stock indexes closed higher on Friday but showed declines for the week, which was marked by investor jitters over fluctuating government bond yields and a lack of clarity on progress in the Middle East.
The S&P 500 .SPX and the tech-heavy Nasdaq .IXIC snapped three-week winning streaks, while the Dow .DJI registered its second consecutive weekly loss.
Equity investors have been taking their cues from the direction of U.S. government bond yields in recent sessions as the prospect of higher borrowing costs dampened risk appetite.
Stocks had closed lower on Thursday as bond yields rose while equities had advanced on Wednesday as bond yields fell. U.S. Treasury Secretary Scott Bessent said on Thursday that the government could further increase its Treasury repurchases after a surprise announcement on Wednesday that it would spend double the expected amount on bond buybacks.