NEW YORK, April 12 (Reuters) - U.S. energy shares are soaring as investors benefit from rising oil prices and a stronger-than-expected economy, while seeking to protect their portfolios from a feared resurgence of inflation.

The S&P 500 energy sector is up about 17% in 2024, roughly doubling the broader index's year-to-date return. Its gains have accelerated in recent weeks, making it the S&P 500's best performing sector in the past month.

One key driver is the price of oil: U.S. crude has risen 20% year-to-date due to an unexpectedly strong U.S. economy and worries over a broadening Middle East conflict.

Some investors also believe rising energy shares could hedge against U.S. inflation. Consumer price rises have proven more stubborn than expected this year, threatening to restrain the broader stock rally by undermining expectations for how much the Federal Reserve will cut rates in 2024.

"If inflation is going to pop up again ... the hedge is to have some commodities exposure," said Ayako Yoshioka, senior portfolio manager at Wealth Enhancement Group.

The portfolios she manages have been overweight in energy stocks, including those of oil majors Exxon Mobil and Chevron, as she noted more disciplined capital spending by energy companies.

Among the top energy sector performers so far this year were Marathon Petroleum, up 40%, and Valero Energy, up 33%.

The economy will be in focus in the coming week as first-quarter earnings season heats up, with reports from Netflix, Bank of America and Procter & Gamble . Monthly U.S. retail sales out on Monday will offer a view into U.S. consumer behavior, on the heels of another stronger-than-expected inflation report last Wednesday.

Energy stocks have risen as a U.S. equities rally has broadened beyond the growth and technology companies that led gains last year. Investors' appetite for non-commodities-related sectors could take a hit, however, if inflation expectations keep rising and worries about a hawkish Fed grow.

Inflation fears have made markets more turbulent in recent weeks. Outside of equities, concerns over rising consumer prices have lifted gold, a popular inflation hedge, to record highs. Energy stocks were also thriving outside the U.S.

Shares of miners, steel firms and other commodity-linked companies have risen along with energy stocks.

"Investors are looking at the world and they're seeing that the economy really isn't slowing down much ... at a time when there are various concerns over bottlenecks regarding supplies of commodities, especially oil," said Peter Tuz, president of Chase Investment Counsel Corp.

Energy shares fell nearly 5% in 2023, while the broader S&P 500 gained 24%. But their inflation hedging credentials received a boost in 2022. That year, the S&P 500 energy sector jumped about 60%, providing a bright spot in a stock market that plunged as the Fed raised interest rates to fight inflation that had reached 40-year highs.

Strategists at Morgan Stanley and RBC Capital Markets in the past week reiterated their bullish calls on energy shares. In a note, RBC's Lori Calvasina cited heightened geopolitical risks and a "growing acceptance of the idea that the economy is actually quite strong."

Analysts are also noting comparatively low valuations. The S&P 500 energy sector trades at 13 times forward 12-month earnings estimates compared to nearly 21 times for the overall S&P 500, according to LSEG Datastream.

Oil prices could take a hit if Middle East tensions ease, or if global growth starts to wobble, potentially clouding the outlook for energy shares.

Conversely, strong economic growth could boost corporate profits and steer investors into other sectors that have done well this year, such as industrials and financials. Companies in the S&P 500 are expected to increase earnings by 9% this year, LSEG IBES data showed.

Marta Norton, chief investment officer in the Americas for Morningstar Wealth, said her firm owns shares of energy pipeline companies and other Master Limited Partnerships, or MLPs, which could protect against firmer inflation.

Still, she believes the economy could begin slowing in coming months, allowing the Fed to cut rates in June.

"What we see today is that the timing around a Fed pivot and the timing around how the economy actually slows is really an open question," Norton said. "You really need to manage a portfolio for a range of outcomes."

(Reporting by Lewis Krauskopf; Editing by Ira Iosebashvili and Richard Chang)