The stock market is off to a rough start this year. Most major indexes have lost ground, with the S&P 500 and Nasdaq Composite both down more than 5% this year. However, one sector has bucked the trend: energy. The SPDR S&P Oil & Gas Exploration & Production ETF is up more than 36% year to date, as oil and gas prices have skyrocketed. 

Two of the exchange-traded fund's largest holdings are ExxonMobil (XOM -2.63%) and Diamondback Energy (FANG 0.78%). The former is an established integrated supermajor with a history dating back to 1870. The other is an upstart with fewer than 1,000 employees. But which is the better buy? Here's a closer look at each.

Two oil workers wearing hard hats and vests in front of an oil rig.

Image source: Getty Images.

ExxonMobil: An energy sector aristocrat

When it comes to energy stocks, ExxonMobil is one of the most well-known. The Texas-based company is fully integrated -- meaning it engages in every facet of the energy production and delivery process. It searches for new reserves, pumps products to the surface, stores them, transports fuels to refineries, it even operates the stations that sell refined gasoline. 

ExxonMobil is a gigantic company, with 63,000 full-time employees who work all over the world. Its market cap of roughly $360 billion makes it the 15th-largest U.S. company -- and the largest American energy stock. Indeed, ExxonMobil's size is one of its best selling points. Its diversified operations and enormous scale provide it the stability that many other energy stocks lack. 

What's more, its share price is largely immune to the rampant volatility in other energy stocks. Its beta, which measures how closely a stock's price is correlated to the broader market, is 1.15 -- meaning that ExxonMobil is only about 15% more volatile than a general measure of the stock market, such as the S&P 500. Compare this to Diamondback, whose beta of 2.31 indicates that it is more than twice as volatile as the S&P 500 and ExxonMobil.

But low volatility doesn't necessarily mean low returns. ExxonMobil shares have gained 50% over the last year, while the S&P 500 has returned 17% during the same period. Revenue for 2021 increased to $276 billion, up from $179 billion a year earlier. Free cash flow surged to $36 billion versus an outflow of $2.6 billion in 2020. It has increased its annual dividend payment every year for 39 consecutive years, and it now stands at $3.52 per year -- a yield of 4.2%.

The company beat earnings estimates in each of the last four quarters to record $5.39 in earnings per share (EPS) in 2021. With energy prices racing higher, Wall Street has struggled to adjust its earnings estimates for ExxonMobil. Analysts now project EPS to rise to $8.23 in 2022, up from projections of $6.11 only 60 days ago.

ExxonMobil is for you if you're looking for an oil stock with stability but some upside if oil prices rise.

Diamondback Energy: Smaller and riskier, but with more upside

Investors looking for an energy name with a bit more sizzle might find Diamondback Energy more to their liking. Diamondback is an independent exploration and production company that operates in the Permian basin, stretching across West Texas and New Mexico. As a producer, Diamondback's share price is extremely sensitive to changes in oil and natural gas prices. Recently, this trend has worked in the company's favor. Shares soared 98% over the last year as oil and gas prices rebounded from pandemic-induced lows.

Since it lacks midstream (e.g., transportation and storage) and downstream (e.g., retail) operations, Diamondback's profit margins can soar to much higher levels when commodity prices rise. During the previous 12 months, its operating margin was 48.1%, compared to 9.6% for Exxon. It's also cheaper. Diamondback has a forward price-to-earnings ratio of 7.4 compared to Exxon's 10.

Moreover, Diamondback just delivered exceptional earnings results. It beat on both the top and bottom lines, solidified its balance sheet by paying down debt and exceeded its internal target of returning 50% of free cash flow to its shareholders. For the full year of 2021, it reported EPS of $12.30, up from a loss of $28.59 in 2020. Looking ahead, average estimates for 2022 EPS come in at $20.84, but like with Exxon, analysts are struggling to keep up with the oil market and have raised those estimates several times in recent weeks.

Both oil stocks look like winners

In this case, the decision comes down to the investor. Each of these stocks has a place in a diversified portfolio, but each fills a different need.

ExxonMobil is perfect for investors seeking some exposure to oil prices. Its solid, reliable dividend also helps generate quarterly income. On the other hand, Diamondback offers a ton of exposure to oil prices. Its annual dividend of $2.40 is modest, yielding only 1.7%. Diamondback is more suited for investors who are bullish on the long-term prospects for fossil fuels and also willing to ride out the ups and downs of the oil market.

While either stock can be a match depending on the investor, I prefer Diamondback due to its smaller size, which makes it a potential buyout candidate at some point down the road.