A surge in energy stocks is challenging climate-conscious money managers who beat the market for years when the sector struggled but are now missing out on Wall Street’s hottest trade.

The S&P 500 energy sector has rebounded 54% this year, outpacing the broad index’s 21% climb and leading the second-best performing group by about 16 percentage points. That would mark the third-largest such gap between the top two sectors since 2000, according to Dow Jones Market Data. 

Big...

A surge in energy stocks is challenging climate-conscious money managers who beat the market for years when the sector struggled but are now missing out on Wall Street’s hottest trade.

The S&P 500 energy sector has rebounded 54% this year, outpacing the broad index’s 21% climb and leading the second-best performing group by about 16 percentage points. That would mark the third-largest such gap between the top two sectors since 2000, according to Dow Jones Market Data. 

Big gains in shares of companies such as Devon Energy Corp. and EOG Resources Inc. are now putting some investors in a bind. Many limited their positions in the energy sector after the group lagged behind the S&P 500 in eight of nine years through 2020, hurt by low oil and gas prices and rising global supplies. 

For much of that period, traders were rewarded for favoring green-energy companies that were perceived to have more attractive long-term prospects. Calls for large investors to divest from fossil-fuel producers crescendoed.

But now, those who avoided the sector also avoided its 19% surge in the past month. The S&P 500 is up about 3% in that span. Investors who for years could easily eschew companies such as Exxon Mobil Corp. or Chevron Corp. must choose whether the possibility of rosy returns outweighs their climate considerations. 

“It is a test of your conviction,” said Lee Baker, president of Apex Financial Services. “It’s hard not to ride the wave when you see an opportunity.”

Mr. Baker recommended that clients buy shares of energy companies such as Exxon and Chevron when shares cratered at the onset of the coronavirus pandemic. He is now advising them to hold them, wagering that they could climb even higher. A few of his clients still prefer to limit their investments in energy due to climate concerns. 

The percentage of fund managers holding a larger position in energy stocks than the benchmarks they track recently hit its highest level since 2012 in a monthly Bank of America Corp. survey. 

Investors could have some alternatives. Citigroup Inc. analysts recently compiled a basket of global stocks that are correlated with the energy sector but have better environmental, social and governance—or ESG—scores. European banks featured prominently in that group, likely because energy prices tend to climb alongside government-bond yields when the economy expands. Rising bond yields boost lending profitability for banks. 

Such trades are in focus because U.S. crude-oil prices have risen to their highest level in seven years at $84 a barrel. The power-generation fuel natural gas has roughly doubled this year and trades above $5 a million British thermal units. 

The rapid price increases threaten the global economy heading into winter, when demand rises from consumers heating their homes. Surging energy bills and fuel costs at the pump are contributing to investors’ worries about inflation and eventual interest-rate increases. Meanwhile, power shortages are shutting factories in parts of Asia and Europe, exacerbating global supply-chain disruptions.

Energy producers and refineries around the world are struggling to meet demand after reducing investments in new fossil-fuel supply. An Exxon facility in the U.K.

Photo: PHOTO: Luke MacGregor/Bloomberg News

The economic ripples are pressuring policy makers leading into a global climate summit in Glasgow, Scotland, that begins on Oct. 31. Many analysts say tumbling investments in new supply by energy producers—at least in part to assuage investors who want them to limit emissions—are helping drive up prices.  

Investors will also be monitoring the latest earnings results from Exxon and Chevron this week to gauge whether energy companies will increase production. Some analysts expect energy firms to drive much of the stock market’s earnings growth moving forward if oil and gas prices stay elevated. 

SHARE YOUR THOUGHTS

Should climate-conscious investors be worried about the current surge in energy stocks? Why or why not? Join the conversation below.

Deciding whether to put more money into these stocks than market benchmarks is also tricky because S&P 500 energy companies make up only about 3% of the broad index. They were more than 15% of the S&P 500 at their peak in 2008, before commodities crashed and technology became the world’s dominant industry.

The sector’s minuscule influence means that investors who put money into market-tracking funds such as the roughly $400 billion SPDR S&P 500 ETF Trust haven’t gotten much of a boost.

Many analysts are wary of “greenwashing,” the practice of energy companies and investment firms making their operations seem more environmentally friendly than they really are. 

Phil Orlando, chief equity-market strategist at asset manager Federated Hermes, said the company has been favoring the energy sector in recent months while still keeping it as a small part of portfolios and prioritizing ESG factors. He said the firm tries to engage with management teams at energy companies and favors those that are working to limit climate damage.  

“You’ve got to try to find that tricky middle ground,” he said. “You can make money here and be ESG compliant and conscious at the same time.”

Traders are monitoring energy stocks in particular because they represent the main way that many investors wager on oil and gas. Still, those who trade commodity futures contracts or invest in bonds tied to energy producers must also decide how much climate factors influence their fossil-fuel positions.

Amanda Agati, chief investment officer at PNC Financial Services Group Inc., said concerns about the sector’s climate impact factor into her decisions differently depending on the investment strategy she is working on.

Her firm continues to hold a smaller energy-stock allocation than the S&P 500, betting that higher supply from the Organization of the Petroleum Exporting Countries and other producers will eventually cool the rally at the same time that renewables gain traction. 

“It’s definitely one of those crossroads moments for the sector,” she said.

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