It seems like ages ago that a pandemic and massive supply glut forced oil prices to temporarily fall below zero, meaning that sellers were paying buyers to take their oil. It decimated stocks like oil major ExxonMobil (XOM -0.84%), which fell as much as 70% from its high.

But investors who braved the volatility were handsomely rewarded -- shares rebounded after oil markets recovered to fuel tremendous profits in 2022 when oil prices surged. A $10,000 investment would already be worth more than $29,000 today.

The lessons learned from this scenario can prepare investors for the next potential downturn in a historically cyclical industry. Here is how ExxonMobil investors have fared since 2020 and what it could mean for them moving forward.

A comeback story worth remembering

Understandably, investors would panic when oil prices plunge. An oil stock like ExxonMobil is sensitive to commodity prices -- exploring for and extracting oil costs ExxonMobil a certain amount, which it then sells at market prices. The company loses money if market prices don't at least cover its break-even price. The events of 2020 led to ugly operating results. The company posted a $22 billion loss.

But ExxonMobil is alive and well today. Investors who bought on April 20, 2020, the day oil prices went negative, made out very well. The stock has clobbered the S&P 500 since then, and dividends have boosted returns by another 18% in under three years.

XOM Chart

XOM data by YCharts

The ferocious downturn in oil prices during the pandemic was followed by an explosive upswing in commodity prices, delivering billions of cash profits to ExxonMobil throughout 2022.

Should you buy ExxonMobil today?

Today, ExxonMobil sings to investors like a siren to sailors at sea. What's not to like? The stock's been cruising while growth and technology stocks have been crushed -- the company pays an extraordinary dividend that yields 3.4% today and has seen 40 consecutive increases (yes, even through the chaos of 2020 and 2021).

But is it too late to buy? The stock's price-to-book value ratio (P/B) is 2.1, slightly ahead of its average over the past decade. However, you can see below how ExxonMobil is generating a much higher return on its employed capital than in recent years. That's largely thanks to the company's efforts to lower costs and focus on more profitable projects; over 90% of its upstream capital investments moving forward should generate double-digit returns at oil prices as low as $35 per barrel.

It's probably hard to call the stock a bargain after its fantastic run. Still, ExxonMobil is more efficient now than in years, and it arguably deserves a higher valuation because of that.

XOM Price to Tangible Book Value (10y Median) Chart

XOM Price to Tangible Book Value (10y Median) data by YCharts

Oil stocks are cyclical businesses, and there will probably be another downturn (though the 2020 crash was worst than most). Fortunately, ExxonMobil's lucrative recovery has largely healed the company's finances. ExxonMobil has just $8 billion in net debt today (total debt minus cash) and recently announced a massive $50 billion share repurchase program. That could retire more than 10% of outstanding shares at today's stock price, which means paying fewer dividends. A 10% share count reduction would save ExxonMobil $1.5 billion in annual dividend expenses.

You've already seen ExxonMobil pull through a global pandemic that helped cause historically low oil prices, and the company's financials seem ready for the next catastrophe. So what's the takeaway? Investors can consider buying shares on dips; ExxonMobil's more efficient structure can drive solid long-term returns for investors.