By Amrith Ramkumar

Prices for raw materials including oil and copper are surging as the world economy reopens for business, a signal to many investors that global growth is returning more quickly than anticipated.

The recent gains come after coronavirus lockdowns dented commodity prices earlier in the year and are a boon for battered producers like copper miner Freeport-McMoRan Inc. and energy giant Exxon Mobil Corp. -- many of which have cut supply in response to industry turmoil. Investors closely watch commodities because their prices fluctuate based on real-time changes to supply and demand and momentum in the global manufacturing sector.

That means commodity prices tend to climb when factories are buzzing with activity, ships laden with goods are moving around the world and consumers are traveling. Data recently showed big increases in retail sales and U.S. employment last month, though joblessness remains at historically high levels due to the pandemic. Activity has also been rising in China's manufacturing sector.

Those trends are also contributing to a burgeoning stock rally that has pushed the S&P 500 up 38% from its March lows.

China is the world's dominant commodity consumer, and the uptick in economic activity there and elsewhere signals that the world economy is in the initial stage of healing from the pandemic, analysts said. Historically, the recovery phase following economic downturns corresponds with big increases in materials prices.

"There's more and more confirmation that we have passed the low, and the fiscal and monetary stimulus keeps coming in," said Jeroen Blokland, a senior portfolio manager at Dutch asset manager Robeco. "That is a very powerful mix." Robeco recently added commodities to the firm's multiasset portfolios for the first time since late in 2013.

With drivers returning to the road, U.S. crude-oil futures have risen near $40 a barrel -- a strong recovery after they briefly fell below $0 for the first time ever in late April due to a lack of available storage. Industrial metals have also been on a tear, with copper and tin up more than 15% so far this quarter. Even agricultural commodities like cotton are rising.

As demand increases, the pandemic and early-year collapse in prices are roiling commodity supply chains, which some investors said could fuel further gains.

"The opportunity is phenomenal," said Leigh Goehring, managing partner at natural-resources investment firm G&R Associates. "Supply is just so vastly impacted that you could get a real squeeze in the commodity markets." The firm has increased its investments in energy producers recently while maintaining its positions in copper miners.

Despite concerns that a new spike in global coronavirus cases could derail the run, some traders expect the rebound to continue as demand improves. The Citigroup Economic Surprise Index for the U.S., a gauge of whether growth figures are generally meeting expectations, has risen to its highest level on record in data going back to 2003. Industrial production in China accelerated in May, while investment in factories, railroads and new homes is also improving.

Hedge funds and other speculative investors are hopeful. They lifted net bets on higher U.S. crude-oil prices in 10 consecutive weeks through June 9, propelling them to a nearly two-year high, Commodity Futures Trading Commission data show. Investors have also pushed up net bullish copper bets lately.

Even if the economic recovery slows down, some analysts are counting on supply reductions and government spending on infrastructure projects and other programs to prevent another commodity collapse.

"Governments around the world are likely to continue to stimulate their economies, helping to boost copper demand from the current low levels," said Freeport-McMoRan Chief Executive Richard Adkerson at a virtual industry conference last month. Freeport shares have rebounded 56% this quarter, while shares of S&P 500 energy producers are up 33% during that span.

Some analysts think mining stocks are particularly attractive because supply for industrial materials could remain constrained due to a lack of spending on new projects in recent years. Morgan Stanley found in a recent analysis that mining stocks also tend to perform well after the U.S. economy exits from recessions.

The outlook for oil prices is more murky because large producers in the Organization of the Petroleum Exporting Countries and allies like Russia could increase supply if crude prices keep rising. Some U.S. shale producers like Parsley Energy Inc. and EOG Resources Inc. are also expected to gradually ramp up production in response to higher prices.

Still, some investors are wagering it will be difficult to quickly bring global production back. They are forecasting long-term supply shortages as demand rises.

"Longer term the outlook remains fairly bright," said Candice Bangsund, a portfolio manager at Fiera Capital, which holds an investment in commodities in line with the benchmark it tracks. But in the meantime, "there's still considerable uncertainty regarding the outlook and little visibility as to how the economy will evolve."

Write to Amrith Ramkumar at amrith.ramkumar@wsj.com