The stock market’s rise this year has narrowed around a short list of big tech companies, a sign of possible weakness heading into 2022.

Five of the biggest stocks in the S&P 500 account for more than half of the broad benchmark’s gain since April, analysts at Goldman Sachs found. Of the S&P 500’s 22% advance this year, those stocks—Microsoft Corp., Nvidia Corp., Apple Inc., Alphabet Inc. and Tesla Inc.—are responsible for around a third. 

The...

The stock market’s rise this year has narrowed around a short list of big tech companies, a sign of possible weakness heading into 2022.

Five of the biggest stocks in the S&P 500 account for more than half of the broad benchmark’s gain since April, analysts at Goldman Sachs found. Of the S&P 500’s 22% advance this year, those stocks— Microsoft Corp. , Nvidia Corp. , Apple Inc., Alphabet Inc. and Tesla Inc. —are responsible for around a third. 

The dominance of a handful of tech behemoths marks a shift from the more-inclusive run-up that propelled the stock market late last year and in early 2021. Investors appeared to be returning to a favored trade of the past decade—focusing on a few large, growing, profitable tech companies—for safety, analysts said, as they contend with a string of anxieties that have sapped confidence.  

That has the S&P 500—and the more than $5 trillion that follow it through passive funds—on precarious footing heading into the new year, several analysts and investors said. “If those companies, for whatever reason, stop performing, there’s nothing to support the market,” said Peter Cecchini, director of research at hedge fund Axonic Capital.

Investors have been getting a harsh dose of that reality in recent trading sessions. The S&P 500 fell nearly 2% during the week, as shares of Microsoft, Nvidia, Apple, Alphabet and Tesla all slid at least 4.2%. Losses piled up further Monday, as the broad benchmark slid another 1.1%, with all five big tech stocks closing in the red.  

Investors appeared to be trading out of those stocks and shares of other high-growth companies in favor of more defensive holdings, such as consumer staples and utilities, in response to the Federal Reserve’s decision last week to enact a policy pivot to combat runaway inflation and the latest Covid-19 variant. Supply-chain bottlenecks and concerns about the earnings outlook next year, which still calls for solid growth, have compounded investors’ souring sentiment.  

Expectations that stock prices will fall over the next six months jumped to 42% earlier this month, the most bearish reading in more than a year, according to a weekly sentiment survey conducted by the American Association of Individual Investors. The Nasdaq advance-decline line—which compares the number of securities on the exchange that fall each day with the number that rise—has mostly fallen over the past month, recently hitting its lowest level since November 2020. 

Unprofitable growth stocks, the darlings of 2020’s rally, have already been hit, said Vincent Deluard, a global macro strategist at StoneX Group, who has identified more than 300 unprofitable companies that have fallen more than 50% from recent highs. 

One measure of market breadth compares the performance of the market-cap weighted S&P 500 with an equal-weighted version. The latter usually outperforms the former when a greater number of stocks are rising; that happened between November 2020 and April 2021, when the equal-weight benchmark outpaced its counterpart by 7 percentage points. Over the past six months, the S&P 500 has outpaced the equal-weight index by nearly 4 percentage points. 

Other indicators of how many stocks are moving the major indexes also tell a story of declining market breadth. One such measure, the share of New York Stock Exchange stocks closing above their 200-day moving averages, dropped as low as 41% earlier in December, a 17-month low. 

There have been only 11 other instances since 1980 where market breadth narrowed as sharply as it did between April and October, according to Goldman analysts, the last coming in 2018. Following most of those periods, the analysts said, the S&P 500 posted below-average returns over subsequent one-, three-, six- and 12-month intervals.

After stock-market leadership narrows, it usually takes four months to widen again, Goldman said. Even if leadership does eventually widen, the biggest stocks in the S&P 500 will continue to exert significant influence, so a sustained pullback by one or more could counteract gains across the rest of the benchmark and the indexed funds that follow it. 

“What worries me the most is the fragility—that so much value is in such few companies,” said Olivier Sarfati, head of equities at GenTrust.  

Some economic indicators suggest stocks are in a position to move higher. Corporate earnings and profit margins have surpassed expectations, while nominal and real interest rates are expected to rise but remain low, giving stocks some support, Goldman’s analysts said. 

But other analysts and investors say those conditions could break down. FactSet on Friday said the number of companies issuing negative earnings guidance for the fourth quarter outpaced upward revisions for the first time since the second quarter of last year. 

SHARE YOUR THOUGHTS

How bullish are you feeling about the stock market as you look ahead to 2022? Join the conversation below.

Corporate earnings have the potential to worsen as more companies grapple with inflation and supply-chain blockages, Mr. Cecchini said. During periods where both the producer-price index and the consumer-price index are positive and the former exceeds the latter by more than 3%, he said, company operating margins tend to suffer in the coming quarters. 

The latest figures from the Labor Department have just about met both hurdles. 

“I think we’ll start to get more downward revisions on earnings guidance,” said Mr. Cecchini. “That’s widely underappreciated by investors.”

—Hardika Singh contributed to this article.

Write to Michael Wursthorn at michael.wursthorn@wsj.com