Overall, the stock market's performance has been pretty horrendous over the past couple of months. However, one industry has far outperformed the others: energy. Since the start of 2022, the sector-tracking S&P 500 Energy index is up an incredible 47% versus the S&P 500's decline of almost 18%. It's rare to see this kind of outperformance in one industry, and especially notable from a sector that has performed so poorly over the past decade. Even with its recent gains, the S&P 500 Energy index is up by less than 30% in the last 10 years.

Given all that, some investors may be wondering if energy stocks still have the potential to outperform from here. While there may be some questions about the fossil fuel industry's longevity, oil will remain a key energy source for at least the next decade. Here's why ExxonMobil (XOM -0.41%) and Occidental Petroleum (OXY -1.04%) stand to benefit from this demand.  

Oil refinery workers walking.

Image source: Getty Images.

ExxonMobil

ExxonMobil is the largest U.S.-based oil and natural gas company by market cap. Like most oil and gas giants, it operates largely in the upstream and downstream segments of the oil industry -- both exploring and extracting fossil fuels, and manufacturing various chemicals and petroleum-based products with them.

As economies around the world have reopened, demand for oil and gas has risen, but for a host of reasons, supplies have remained constrained. As a result, ExxonMobil's financial results have been fantastic. It reported $87.7 billion in sales in the first quarter, up 52% year over year. Despite producing fewer barrels per day in oil equivalents, ExxonMobil reported a 76% increase in earnings from its upstream operations. Overall, earnings rose 101% over the prior-year period, which resulted in nearly $14 billion in cash flow.

As management has brought the company's debt-to-capital ratio into its target range of 20% to 25%, they have decided to use that cash flow to repurchase shares. With the authority to buy back up to $30 billion worth of shares through 2023, ExxonMobil will reduce its outstanding share count by about 8%. At current share prices, its dividend yields about 4%.

However, ExxonMobil trades at about 15 times earnings, which is at the high end of its valuation range over the past 15 years. Investors should therefore be cautious about opening a new position in this stock, as it could revert to a level in the lower part of its range.

Oil drill workers working on a drill.

Image source: Getty Images.

Occidental Petroleum

Occidental focuses on the exploration and extraction of oil and natural gas, and also operates in the midstream segment, managing pipelines between drilling sites and processing facilities. The business is also one of Warren Buffett's larger holdings (2.8% of its investment portfolio, the seventh-largest holding), as Berkshire Hathaway owns about 15% of Occidental's shares and has warrants to purchase even more, which would up his stake to 22%.

So what does Buffett see in this business? First off, Occidental Petroleum is incredibly profitable right now. Management has pointed out that it needs prices for West Texas Intermediate crude to stay at $40 per barrel to maintain its quarterly dividend, not its profitability. With crude averaging $94.29 per barrel in Q1, Occidental moved from a bottom-line loss of $0.36 per share in Q1 2021 to a $4.65 per share profit in Q1 2022. Overall, it produced $3.3 billion in free cash flow, which it immediately funneled into paying down debt.

Oil rig on the ocean.

Image source: Getty Images.

Management has set a goal of reducing Occidental's debt to less than $20 billion, and is putting much of its cash flow toward that end. In the past year, the company has trimmed its outstanding debt from $35.5 billion to $25.8 billion, and given the way the oil market looks right now, will likely be able to reach its target by year's end.

After they've cleaned up the balance sheet, management will likely increase the dividend (which at current prices yields 0.8%, pretty low for an oil and gas company) and repurchase shares. These initiatives will reward shareholders over the long term, but what about the stock itself?

Despite many rises and falls, Occidental is still nearly 40% down from the all-time high it set in 2010. Additionally, valuing Occidental is difficult, as it has spent several years in an unprofitable state as the market fluctuates around it. Because of this, I plan to steer clear of Occidental's stock.

Shares of ExxonMobil and Occidental may outperform the market over the next few months or even the next year. However, I doubt either can beat the market over a three- to five-year time frame.