Devon Energy (DVN -0.31%) has hit a bit of a rough patch. The oil company was red-hot last year, rallying nearly 40%. However, it has cooled off considerably in recent months, falling 27% from its peak.

Here's a look at whether Devon has run out of fuel or the energy stock has more left in the tank to rally.

Why is Devon Energy's stock down?

Devon Energy got a big boost from higher oil and gas prices last year. Its free cash flow more than doubled to $6 billion. That gave it the funds to pay a gusher of dividends, repurchase stock, make accretive acquisitions, and repay debt.

However, energy prices have started to cool off in recent months. Because of that, Devon's cash flow has fallen from its peak, impacting dividend payments due to the company's variable payout policy.

A chart showing Devon Energy's total dividend payment each quarter over the past year.

Data source: Devon Energy. Chart by author.

The steadily falling variable dividend payment has weighed on the stock price in recent quarters. That's because the company's annualized dividend yield has fallen from 8% at its peak rate and price point to 6.3%, based on its most recent payment level and share price. The falling dividend is making it less attractive to income-seeking investors.

Adding further weight to the company's share price is the expectation that free cash flow will be significantly lower than last year. The company's outlook assumes $80 oil for 2023. Devon will produce less than $3 billion in free cash flow at that price point because capital spending will rise due to inflation and recent acquisitions. As a result, it will have even less free cash flow to pay dividends and repurchase shares this year.

Down but not out

Those negatives are causing investors to overlook some positives. For starters, the company trades at a very attractive valuation these days. Devon Energy sells at an 8% free-cash-flow yield, based on the free cash flow it can produce at $80 oil. That's much cheaper than the broader market indexes. The S&P 500 currently trades at a 5% free-cash-flow yield, and the Nasdaq Composite sells at a 4% free-cash-flow yield (a lower yield implies a more expensive valuation).

Meanwhile, Devon Energy's oil price forecast might be too conservative. Several catalysts could drive oil prices back up toward $100 a barrel by this summer. The International Energy Agency (IEA) recently increased its oil demand outlook, forecasting it will grow by two million barrels per day this year to a record 101.9 million barrels. Fueling that outlook is a demand resurgence in China and increased global air traffic.

Meanwhile, the IEA expects supplies to grow by only 1.2 million barrels per day. Weighing on supplies is the impact sanctions will have on Russian output. This forecast suggests that global oil demand will outpace supply in the second half. That should boost oil prices.

Higher oil prices would enable Devon Energy to generate even more free cash flow, half of which it would pay out in dividends. It could also use its incremental free cash flow to buy back more of its cheap shares. The company is currently on track to retire 5% of its outstanding stock as it works to complete its $2 billion repurchase program.

A potentially great time to buy

After selling off, Devon trades at an attractive value relative to the free cash flow it can produce at $80 a barrel. Though, that outlook might be very conservative, given all the upside catalysts for crude prices. Because of that, the sell-off in Devon Energy looks like a potentially attractive buying opportunity, especially for investors who believe oil prices could heat back up this summer.