Stock investors are positioning for a recession. 

A monthslong selloff in the stock market has accelerated lately, with the pain spreading beyond technology shares and speculative corners of the market. Recently, even consumer-staples companies, which had been relatively shielded from the turmoil, have taken a hit. 

Major indexes are hovering near their lows of the year, with the S&P 500 down 18%, including a 3% decline this week. The index’s consumer-staples sector—home to companies including Walmart Inc. , Kroger Co. , Coca-Cola Co. and Kraft Heinz Co. —has dropped 8.6% over the past five sessions. 

Many investors say they have been struck by the length and sheer magnitude of the recent selloff, which is in its fifth month and has been characterized by sharp intraday swings not seen since March 2020. 

“The selloff is well into recessionary territory,” a team of analysts at Deutsche Bank led by Binky Chadha wrote in a note to clients Wednesday. 

The analysts added that the S&P 500 is edging closer to the typical decline of about 24% seen in recessions dating back to 1946, and that the current selloff, at more than 90 trading sessions, has extended well beyond the typical downturn not associated with a contraction.

To some investors, the latest batch of earnings reports flashed one of the biggest warning signs yet. Results from big-box retailers such as Target Corp. and Walmart showed that higher inflation is chipping away at corporate profits. And Kohl’s Corp. said demand weakened as inflation squeezed household budgets, raising questions about the strength of consumer spending going forward.

That is a bad signal for investors who were banking on strong results and the resilience of U.S. corporations to buffer the market in coming months. Target’s shares are off 29% this week, while Walmart has fallen 19% and Kohl’s is also down 19%.

Meanwhile, Federal Reserve Chairman Jerome Powell

recently hammered home that the central bank won’t hesitate to increase interest rates, potentially slowing economic growth. “There could be some pain involved to restoring price stability,” he said this week at The Wall Street Journal’s Future of Everything Festival.

“Recession risk is definitely rising,” said Zhiwei Ren, a portfolio manager at Penn Mutual Asset Management. “You have a weakening economy and a hawkish Fed. It’s not too hard to be a little bit more pessimistic about asset prices.” 

Mr. Ren said he has been betting against the S&P 500 through the futures market and has grown more cautious in his bond investments too, favoring higher-rated corporate bonds rather than riskier ones. 

One source of refuge for anxious investors has been shares of dividend-paying companies, which promise a steady stream of cash even as share prices fluctuate. Some traders are betting that cushion might be about to take a hit as well.   

In the derivatives market, futures tied to stock dividends show investors expect S&P 500 dividends will decline in 2023, according to analysts at Goldman Sachs. Dividends from the benchmark index haven’t fallen from one year to the next outside of a recession during the past 60 years, they said. 

The futures market is pricing S&P 500 dividends per share at $64.55 this year, but only $60.60 in 2023, implying a drop of about 6%, according to Goldman Sachs.

Some investors see fear about the economy reflected in the recent decoupling of stocks and bonds. The markets had fallen in tandem for much of the year as high inflation and expected interest-rate increases damped their appeal. But the yield on the benchmark 10-year U.S. Treasury note reached a peak about two weeks ago and has since fallen as bond prices have risen. That suggests concerns about growth are starting to outweigh inflation worries, leading some traders to reach for safety. 

Meanwhile, prices of industrial metals such as copper and nickel—which typically benefit from a boom in manufacturing activity and a strong economy—have fallen 13% and 42%, respectively, from highs hit in March.  

Many investors are concerned that the Fed under Chairman Jerome Powell won’t be able to combat inflation without significantly raising unemployment.

Photo: Al Drago/Bloomberg News

Within the stock market, traditionally defensive groups such as utilities and healthcare have been holding up better than the broader market, another sign that investors are reaching for safety. The S&P 500’s utilities sector is up 0.3% this month and the healthcare group is off 0.5%, while the broad index has dropped 5.6%. 

Many investors are fearful the Fed won’t be able to combat inflation without significantly raising unemployment. If the central bank raises rates too far and too fast, traders and economists worry, it could tip the economy into a recession. The official arbiter of U.S. recessions, the National Bureau of Economic Research, looks for a significant drop in economic activity that stretches across the economy and continues for more than a few months. 

“It’s historically been a fact that the Fed will react late and then tighten into a slowing economic environment, thereby causing a more severe recession than they intended,” said Rick Pitcairn, chief investment officer at the multifamily office Pitcairn. “And there’s many that think that’s what’s happening.”

Eight of the past 11 extended rate-hike cycles ended eventually in recessions, Deutsche Bank data show. An economic slowdown, in turn, would weigh heavily on consumer spending and corporate profits, likely sending the major stock indexes tumbling even farther. 

SHARE YOUR THOUGHTS

How are you approaching your investment portfolio right now? Join the conversation below.

Still, Deutsche Bank said there are “few if any signs of the typical hallmarks of a recession,” beyond stock positioning. And economic data, so far, remain relatively robust.

The U.S. added 428,000 jobs in April, marking the 12th consecutive month of gains above 400,000, while the unemployment rate hovered at 3.6%, just above the half-century low of 3.5% set before the pandemic.

Consumer spending increased in March as households spent more on travel, dining, gasoline and food. Data this week showed industrial production rose in April, accelerating from the previous month’s increase.

“None of the data that we track, even the leading indicators that look forward, are indicating that recession is on the horizon,” said Cliff Hodge, chief investment officer at Cornerstone Wealth. “People have really fixated on the fact that the Fed is tightening financial conditions to slow growth. That’s not new information.”

Write to Gunjan Banerji at gunjan.banerji@wsj.com and Karen Langley at karen.langley@wsj.com