U.S. stocks rose Wednesday, staging a rebound as investors tried to gauge the strength of the economic recovery.

The S&P 500 rose 0.8% in afternoon trading. The broad stocks gauge fell for the sixth time in seven trading days Tuesday. It is roughly 1.3% below the all-time closing high it notched in early September.

The Dow gained 0.7% on Wednesday,...

U.S. stocks rose Wednesday, staging a rebound as investors tried to gauge the strength of the economic recovery.

The S&P 500 rose 0.8% in afternoon trading. The broad stocks gauge fell for the sixth time in seven trading days Tuesday. It is roughly 1.3% below the all-time closing high it notched in early September.

The Dow gained 0.7% on Wednesday, while the technology-focused Nasdaq Composite climbed 0.8%.

Stocks have retreated in September, with some investors worried that markets are ripe for a pullback after marching higher for much of the year. The Dow has fallen about 2% during the first 10 trading days of the month, putting it on track for its worst start to September since 2008.

Some investors have also voiced concern that the economic rebound wouldn’t be as fast as they previously expected. The spread of the Delta variant of the coronavirus, an economic slowdown in China and supply-chain difficulties have all damped sentiment.

“We’ve shifted from worrying about premature tightening [by the Federal Reserve] killing off the recovery in equities to concerns about the strength of the recovery weighing on equities,” said Sebastian Mackay, multiasset fund manager at Invesco. Mr. Mackay remains upbeat about the outlook for stocks, but said he has taken out insurance against volatility by buying put options.

U.S. industrial production rose at a seasonally adjusted 0.4% in August compared with the previous month, according to Fed data released Wednesday. The reading broadly matched forecasts from economists polled by The Wall Street Journal, who expected a 0.5% rise. But factory output lost some momentum in August compared with July, when it rose by a revised 0.8%.

Oil prices extended a recent rally, driven in part by disruption to output caused by Hurricane Ida. Futures on Brent crude, the international energy benchmark, climbed 2.5% to $75.43 a barrel. More than 39% of oil output in the Gulf of Mexico and 48% of gas output was offline Tuesday, the Bureau of Safety and Environmental Enforcement said.

The floor of the New York Stock Exchange.

Photo: Richard Drew/Associated Press

Energy was the best-performing sector of the S&P 500, boosted by the oil rally. Chevron shares gained 1.5%.

Shares of specialty lender GreenSky surged 52% after Goldman Sachs agreed to acquire the company for $2.2 billion, as part of the bank’s broader plan to reinvent itself as a Main Street player. Goldman shares fell 0.8%.

Shares of casino companies extended their slide after the Macau government set expectations for the future of the gambling industry there, including increased regulatory scrutiny over casino operations. Shares of Wynn Resorts dropped more than 7%, while Las Vegas Sands shares slid 3.5%.

In the bond market, the yield on 10-year Treasury notes rose to 1.314% from 1.276% Tuesday. Yields and bond prices move in opposite directions.

Overseas markets were mostly lower. The Stoxx Europe 600 dropped 0.8%. Stock indexes in mainland China and Hong Kong fell after a range of Chinese economic indicators showed slowing growth. An outbreak of Covid-19 and tighter property regulations hit consumer spending and the housing sector.

In Hong Kong, the Hang Seng Index shed 1.8%, with gambling and property companies among the biggest decliners. Casino companies Sands China and Galaxy Entertainment dropped 33% and 20%.

Write to Joe Wallace at joe.wallace@wsj.com and Alexander Osipovich at alexander.osipovich@wsj.com