Small caps have been stung by big losses this year. Some investors think that may be about to change.

Shares of many small, U.S.-focused companies have raced ahead of the broader stock market in July. Some investors think that signals more room to run for small-capitalization companies, which can often be more agile and react more quickly to economic changes, including a recession.

Both small caps and the broader market have had a terrible year so far. The S&P 500 fell 21% through the first six months of 2022, its worst first-half performance since 1970, according to Dow Jones Market Data. The Russell 2000 index of small-cap companies fell 24%, its worst first half since launching in 1984.

So far this month, the Russell 2000 is up 3.6%, while the S&P 500 is up 3.1%. Some companies are standouts. Tupperware Brands Corp. is up 15% in July, and motor-homes manufacturer Winnebago Industries Inc. is up 9.7%. Fast-food chain Jack in the Box Inc. is up 8%, and apparel retailer Urban Outfitters Inc. has risen 8.7%.

The moves mark a reversal of fortunes for small caps, which have trailed behind the larger S&P 500 for much of this year. Small caps tend to be sensitive to fears of an economic slowdown, since they often generate the majority of their sales in the U.S., compared with large multinationals. Even though many investors and analysts remain nervous about the potential of a recession, some say that after a brutal first half, the group looks due for a rebound.

“I would argue that a lot of the bad news is probably already in small caps,” said Jurrien Timmer, director of global macro at Fidelity Investments. “That’s a glass half-full way of reading the tea leaves.”

Mr. Timmer said that small caps, which peaked before the broader market did, might be poised to hit their bottom earlier too. The Russell 2000 hit its highest level ever in November. The S&P 500 hit its record two months later, in January.

One reason some analysts believe small caps could be ripe for a rebound: valuations.

SHARE YOUR THOUGHTS

How are you handling the small-cap stocks in your portfolio? Join the conversation below.

The S&P 600 index of small-capitalization companies is trading at around 11.3 times its next 12 months of expected earnings, while the S&P 500 is trading at around 16.2 times expected earnings, according to Dow Jones Market Data.

“The only other time small caps were this cheap relative to large caps was during the height of the tech-bubble period,” said Jill Carey Hall, U.S. equity strategist at Bank of America.

Smaller companies may benefit from consumers’ recent spending shift away from goods toward services, as their earnings are more reliant on the latter, Ms. Hall said.

Small companies also tend to be less affected by currency fluctuations compared with multinational companies, which do business across many countries and have to eventually convert sales from overseas into dollars. Currency markets have been volatile this year, and large companies from Coca-Cola Co. to Salesforce Inc. have warned that a stronger dollar is weighing on their results.

Francis Gannon, co-chief investment officer at the small-caps-focused Royce Investment Partners, said his firm has viewed the market’s volatility as an opportunity to pick up small caps that have been neglected.

“They have been kind of a forgotten asset class of late as everybody has been really focusing on the mega cap stocks in the upper end of the S&P 500 or the Russell 1000,” Mr. Gannon said.

Mr. Gannon said his firm looks to buy small-cap companies at significant discounts and then hold them for three to five years. That long-term approach helps juice his firm’s returns, he said—even if others don’t follow suit.

“Psychology is running the market short term here,” Mr. Gannon said.

Write to Pia Singh at pia.singh@wsj.com and Akane Otani at akane.otani@wsj.com