By Anna Isaac and Gunjan Banerji

The S&P 500 edged toward a fresh high Friday and logged a fourth consecutive week of gains, its longest winning streak of the year.

Stocks drifted higher this week during a quiet stretch of trading, as investors tried to reconcile uneven economic signals with expectations of further stimulus from governments and central banks.

The broad stock-market gauge rose 11.65 points, or 0.3%, to 3397.16, a record close. The Dow Jones Industrial Average advanced 190.60 points, or 0.7%, to 27930.33, pulled higher by gains in Apple shares. The Nasdaq Composite added 46.85 points, or 0.4%, to 11311.80, a high.

The S&P 500 gained 0.7% this week, while the Dow was roughly unchanged. The tech-heavy Nasdaq jumped 2.7% this week.

Government stimulus has powered the stock market's recent recovery, sending the S&P 500 to new heights this week. The Federal Reserve's latest minutes showed that central bankers think that more government support is needed to help the economy. Some analysts said they expect the record run for stocks to continue, driven in part by such stimulus.

"I don't see anything that stops the flow of funds into U.S. equities in the near term," said Mike Lewis, head of U.S. equities cash trading. "There's not a lot of places to put your money if you need returns."

Notably, though the broader market has shot up since March, not all stocks and sectors have rallied. The divergence between the stock market's haves and have-nots has grown clearer recently, as companies benefiting from a shift to working from home during the pandemic have notched gains while many others have floundered.

That was on display Friday. Shares of tech companies led the way as they have for much of the year. Apple shares added $24.38, or 5.2% to $497.48, continuing a winning streak for the iPhone maker as its market value surpassed $2 trillion earlier in the week.

Graphic-chip maker Nvidia gained $21.70, or 4.5%, to $507.34. The company posted record sales in its latest quarter, helped by strong demand for online gaming and remote computing services.

"It was a very reluctant high," said Anna Rathbun, chief investment officer of CBIZ Investment Advisory Services, of the S&P 500's record this week. "There wasn't a lot of breadth behind it."

Tesla shares, which have become a favorite for momentum-driven traders, jumped over the $2000 mark on Thursday and advanced another 2.4% Friday to close at $2049.98. Its shares gained 24% this week, continuing a head-spinning stretch for the electric-car maker.

Investors continued to parse mixed economic data. Housing has been a bright spot, giving a boost to home builders. New data released Friday showed that sales of previously owned homes surged in July as low interest rates and a desire for more space helped home-buyer demand.

Home-construction companies PulteGroup added 2.5%, while Lennar gained about 3.2%. New Home jumped 2%.

Still, data on Thursday showing an unexpected increase in new weekly applications for unemployment benefits was a troubling sign that the American labor market's recovery may be cooling amid continuing disruptions from the coronavirus pandemic.

With government bonds offering yields that are below expected inflation levels, investors in recent months have been flooding into risky asset classes including stocks in a search for higher returns.

"More so than ever before, equity markets probably are not the best reflection of real economic conditions in the U.S.," said Derek Halpenny, head of research for global markets in the European region at MUFG Bank.

The yield on the 10-year Treasury note fell to 0.639% this week from 0.708% last week. Yields fall as bond prices rise.

Overseas, the pan-continental Stoxx Europe 600 slipped 0.2% Friday. The Shanghai Composite gained 0.5%, while the Nikkei 225 Index added 0.2%.

The euro dropped 0.7% against the dollar after data showed a smaller-than-expected rebound in the eurozone's manufacturing and services sectors. The currency also came under pressure after Michel Barnier, the European Union's chief Brexit negotiator, told a press conference Friday that a deal with the U.K. was unlikely at this stage. The British pound fell 0.8% against the dollar.

Write to Anna Isaac at anna.isaac@wsj.com and Gunjan Banerji at Gunjan.Banerji@wsj.com