U.S. stocks fell and snapped a three-week winning streak as data showed that consumer sentiment dwindled in early July, driven in part by concerns of high inflation.

The S&P 500 lost 32.87 points, or 0.8%, to 4327.16. The Dow Jones Industrial Average retreated 299.17 points, or 0.9%, to 34687.85, with losses accelerating later in the trading session. The Nasdaq Composite lost 115.90 points, or 0.8%, to 14427.24.

All three major indexes notched weekly losses. The S&P 500 and Dow shed 1% and 0.5%, respectively. The Nasdaq fell 1.9%.

The week has been marked by several choppy sessions of trading as investors parsed a higher-than-expected inflation reading on Tuesday, comments from Federal Reserve Chair Jerome Powell and economic data on Friday.

Shares of cyclical groups like financials and energy companies lagged behind the broader market this week, while the Russell 2000 index of small companies dropped 5.1%, its worst week since October. Meanwhile, Treasurys have continued to rally.

The downturn in these sectors and gains for government bonds highlight how trades that outperformed earlier in the year have been retreating lately. Some investors have grown wary that economic growth will moderate from the blockbuster levels recorded this year.

On Friday, investors parsed some mixed economic data. A report showed that consumer sentiment in the U.S. declined in early July amid concerns over high inflation. Americans’ expected inflation rate rose in July compared with June, a University of Michigan survey showed, with consumers’ complaints about rising prices on homes, vehicles and household durables reaching an all-time record.

Meanwhile, concerns about the Delta variant have flared up lately, weighing on shares of airlines and cruise operators on Friday and making them among the S&P 500’s worst performers. Carnival shares lost $1.03, or 4.7%, to $20.92. Alaska Air shed $2.29, or 4%, to $54.62.

“I think it’s going to be a very volatile second half of the year,” said Shana Sissel, chief investment officer at Spotlight Investment Group.

New data also showed that retail sales rose 0.6% in June, as the economy reopened more broadly and auto dealers navigated supply disruptions. Economists were expecting another decrease after May’s 1.3% drop.

Despite this week’s losses, major indexes have still been hovering near records. Meanwhile, government bonds have staged a big rally.

“I kind of think of it as short-term quiet and long-term uncertainty,” said Joanne Hill, chief advisor for research and strategy at Cboe Vest.

The yield on the benchmark 10-year Treasury note settled at 1.300% on Friday, falling for the third consecutive week.

Some investors remained optimistic about the overall market, pointing to the Federal Reserve’s stance toward raising rates. Federal Reserve Chairman Jerome Powell sought to reassure markets that the central bank sees the rise in prices as uncomfortable but transitory and isn’t in a hurry to adjust its supportive policies.

Related Video

The inflation rate reached a 13-year high recently, triggering a debate about whether the U.S. is entering an inflationary period similar to the 1970s. The Wall Street Journal Interactive Edition

“The Fed is still being pretty patient, Powell has made it clear that they will remain pretty accommodative for some time,” said Salman Baig, a multiasset investment manager at Unigestion. “That’s a relatively good environment for risk taking—good growth, bond yields being relatively stable, investors will be OK with taking on more risk.”

In corporate news, Moderna shares jumped 10.3% after S&P Global said it would add the pharmaceutical company to the S&P 500 index, effective as of July 21.

U.S.-listed Chinese ride-hailing firm Didi Global fell 3.2% after state security and police officials were sent to the company’s offices Friday as part of a cybersecurity investigation.

Overseas, the pan-continental Stoxx Europe 600 slipped 0.3%.

Most major benchmarks in Asia ended the week on a downward note. The Shanghai Composite Index declined 0.7% and Japan’s Nikkei 225 fell 1%.

Stocks ended the week lower after fading Friday.

Stocks ended the week lower after fading Friday.

Photo: brendan mcdermid/Reuters

Write to Gunjan Banerji at Gunjan.Banerji@wsj.com and Anna Hirtenstein at anna.hirtenstein@wsj.com