ExxonMobil (XOM -0.01%) has been a surprising stock market winner this year. Despite sluggish energy prices and the broader sector taking a back seat to the excitement in high-growth technology companies, shares of Exxon are up 20% thus far in 2024 near its all-time high.

The oil and gas giant continues to deliver solid financial results, reaffirming its blue chip status with a long history of generating positive shareholder returns. Heading into 2025, can the rally keep going or is it time for investors to seek out greener pastures?

Let's discuss what to do with ExxonMobil stock now.

Reasons to buy or hold Exxon stock

The attraction of ExxonMobil as an investment starts with its diversified world-class asset portfolio as the market's largest publicly traded integrated energy company. A massive operating scale spanning exploration and production, refining, marketing, and specialty chemicals businesses represents an advantage in the sector in terms of managing risks and leveraging a global infrastructure to maximize cash flows.

That dynamic was a major theme in Exxon's third-quarter earnings report, where an ongoing enterprisewide transformation program has captured $11.3 billion of cost savings since 2019 leading to a structural improvement in earnings power. In this case, the $1.92 in earnings per share (EPS) this quarter came in ahead of the average Wall Street estimate of $1.87 driven by strong upstream production growth. Management noted its 3.2 million barrels per day average in liquids volume was the highest for the company in more than 40 years amid record output in its Guyana and Permian Basin fields. Simply put, Exxon today is managing the impact of lower crude oil and natural gas prices by generating a higher profit per oil equivalent barrel while raising output.

Exxon Mobile investor presentation slide outlining earnings growth.

Image source: ExxonMobil.

With further cost savings and production growth expected in the coming years, Exxon's earnings are well positioned to ramp up, particularly in a scenario where energy prices rebound.

Other strong points for the company this year include its success in the chemicals segment, where volumes of high-value performance products reached a quarterly record in Q3 as a separate growth driver. Robust free cash flow has supported more than $26 billion in share repurchases through the first nine months of the year. Exxon has also announced its latest dividend payout increase, hiking the quarterly rate by 4% to $0.99 per share which yields 3.3% on a forward basis.

Overall, there's a lot to like about Exxon. Investors confident in the company's ability to execute its long-term strategy have plenty of reasons to buy or hold the stock today.

Reasons to sell Exxon stock

As good as the headline numbers may seem or as well as a company has been performing, the reality of the stock market is that various factors are often unpredictable. It's important to acknowledge what could go wrong with an investment idea.

For ExxonMobil, an environment where the demand side of macroeconomic conditions deteriorates rapidly, driving energy prices sharply lower, is the main risk that would force a reassessment of the company's earnings potential. While there are no signs of such development unfolding, it's far from certain that oil prices will accelerate higher.

In that same discussion, the emergence of electric vehicles rapidly gaining market penetration and other forms of renewable energy moving to displace the need for fossil fuels could impact Exxon over the next several decades. Investors concerned that Exxon may be at a secular peak have a reason to consider selling the stock.

Two people in an office environment interacting with a personal computing device.

Image source: Getty Images.

Decision time for Exxon stock

In my opinion, it's a great time to buy ExxonMobil stock with its underlying strengths outweighing any perceived weaknesses. The key assumption is that a resilient global economy should support energy demand and higher oil prices as a tailwind for growth.

Although shares trading at 15 times the company's consensus 2024 EPS as a forward price-to-earnings (P/E) ratio isn't necessarily a dirt cheap bargain, I believe the company's structurally improved earnings potential and consolidated sector leadership justify its premium valuation. For investors with a long-term time horizon, Exxon stock is a good option for exposure to oil and gas within a diversified portfolio.