By Joe Wallace and Gunjan Banerji

U.S. stocks staged a powerful rebound following their steepest selloff since October, but recorded losses for the week.

The week was marked by sharp stock swings in both directions, with a recent stock-market rally almost as strong as the initial selloff, as investors parsed inflation data.

The S&P 500 rose 61.35 points, or 1.5%, to 4173.85 on Friday, with gains accelerating in the afternoon. The Dow Jones Industrial Average added 360.68 points, or 1.1%, to 34382.13. The Nasdaq Composite advanced 304.99 points, or 2.3%, to 13429.98. The gains built on a rally that began Thursday, when major indexes snapped a three-session losing streak.

Still, stocks ended the week with losses. The S&P 500 and Dow each lost at least 1.1%. The tech-heavy Nasdaq was the hardest hit, losing 2.3% for the week and logging its fourth consecutive week of declines, the longest such stretch since August 2019.

Stocks tumbled earlier in the week after new data showed that consumer prices leapt to a 13-year high in April. Prices on everything from cars to hotel-room rates rose, fueled by strong demand from consumers as Covid-19 restrictions have been eased and supply shortages. Investors worry that a surge in prices for raw materials will eat into profit margins and a burst of consumer-price inflation could also prompt the Federal Reserve to pare back easy-money policies that have buoyed stocks.

Investors fled stocks, particularly some of the fast-growing companies that many had favored over the past year. The S&P 500 and Dow suffered their worst three-day losses in nearly seven months to start the week.

Some sectors were harder hit. The S&P 500 growth index fell 2.1% this week, its worst week since February. ARK Investment Management's flagship innovation exchange-traded fund lost 4.9% this week, while Tesla shares dropped 12%. Bitcoin prices also sputtered as Tesla Chief Executive Elon Musk said the company suspended accepting bitcoin as payment for its vehicles.

The inflation fears and falling share prices triggered a surge in bearish options activity tied to the S&P 500, with some traders positioning for steeper declines. Bearish options changing hands hit the highest level of the year on Wednesday, Trade Alert data show, while a measure of stock volatility jumped this week.

The government bond market didn't offer a hedge to investors looking to shield themselves from the volatility of the stock market, as investors also sold Treasurys on worries about inflation. The yield on 10-year Treasury notes rose to 1.639%, up from 1.576% last week. Yields rise when bond prices fall and rising inflation chips away at the purchasing power of the bonds' fixed payments.

But several Fed officials have said in recent days that the central bank has no plan to withdraw support, helping to quickly calm markets and fueling the rebound. The Fed needs to see several more months of data on jobs and inflation before determining when to begin tightening monetary policies, Gov. Christopher Waller said Thursday.

Some investors and analysts said they were reluctant to draw conclusions from the data released this week and remained confident that the Fed would be patient in terms of raising interest rates.

Buyers have rapidly stepped in to the market. U.S. stock funds drew the most inflows since March in the week ending May 12, according to EPFR. That made it the seventh consecutive week of inflows to U.S. stock funds despite the turbulence, the longest such streak since the second quarter of 2018.

"The Fed has been very consistent," said Paul Donovan, chief economist at UBS Global Wealth Management. "That is telling you something: it is telling you [higher inflation] clearly is transitory."

Nonetheless, Mr. Donovan said he expects markets to remain jumpy in response to higher inflation numbers in the coming months. "There will be volatility in the near term over this: not just volatility over inflation, but volatility over the central bank response to that," he said.

Retail sales were unchanged in April from a month before, the Commerce Department said. Economists had expected a rise of 0.8%, following a surge in spending in March, when government stimulus checks boosted household incomes. And fresh data released early Friday showed that consumer sentiment weakened in May as inflation expectations ticked up.

Despite the stock-market rebound, some investors said they thought the market was still due for a pullback after its tremendous run-up this year. Many individual investors have jumped into the market, often buying on small dips in stocks. And even after this week's declines, the S&P 500 is off just 1.4% from its record hit on May 7.

"I feel like we're overdue for a little bit of a breather. Making money isn't supposed to be this easy. It's not supposed to be a one way trade, " said John Porter, chief investment officer of equities at Mellon Investments.

In corporate news, Walt Disney shares fell $4.64, or 2.6%, to $173.70 after the company said late Thursday that its flagship streaming service added fewer users than Wall Street had expected in its fiscal second quarter after months of torrential growth.

While the Covid-19 streaming boom is slowing for now, other pandemic trends appear to be stickier. DoorDash gained $25.58, or around 22%, to $141.07 after saying revenue tripled in the first quarter, showing sustained demand for food-delivery services even as coronavirus vaccinations picked up.

Some of individual investors' favorite stocks were among other bright spots in the market this week, continuing a string of wild moves for meme stocks. Reddit-favorite AMC Entertainment climbed 36% this week. Hertz Global Holdings shares have almost doubled this week as prospects brightened for stockholders in the company, which is set to emerge from bankruptcy.

Brent-crude futures, the benchmark in energy markets, rose for the third consecutive week to $68.71. Copper futures in New York, which hit a record Tuesday, slipped 0.9% to $4.66.

A recent surge in commodity prices has sharpened focus among investors on companies that are likely to see profits pinched by higher input costs.

Stock markets around the world also notched gains. In overseas markets, the Stoxx Europe 600 gained 1.2% Friday. Major Asian markets rallied. Japan's Nikkei 225 gained 2.3% and China's Shanghai Composite Index rose 1.8%.

"We still think the stock market has an upside from here until the year end," said Melda Mergen, deputy global head of equities at Columbia Threadneedle.

Write to Joe Wallace at joe.wallace@wsj.com and Gunjan Banerji at gunjan.banerji@wsj.com.

(END) Dow Jones Newswires

05-14-21 1722ET