There are two conflicting trends in the oil market right now when you look at the big picture and the near-term outlook. And whether there is value in oil stocks probably depends on your view of these two issues. Here are some things to think about as you assess the value opportunity in oil stocks.

The good news

Oil prices fell dramatically in 2020, with a production spat at OPEC and the demand declines stemming from the coronavirus pandemic actually pushing West Texas Intermediate crude below zero for a brief moment. Today that looks like ancient history, with prices having materially recovered. First-quarter earnings for oil companies were pretty good and Q2 numbers should be equally strong, if not even better.

An offshore drilling rig.

Image source: Getty Images.

And yet the stocks of many of the largest and strongest oil drillers, including the integrated oil giants, remain below pre-pandemic highs. Dividend yields in the sector are historically elevated, too, suggesting that the stocks are comparatively cheap. So, in some ways, it does look like investors can find some value in the oil space. For example, industry giants ExxonMobil (NYSE:XOM) and Chevron (NYSE:CVX) are offering generous 6% and 5.4% yields, respectively, backed by long histories of regular annual dividend increases. If you are a dividend-focused investor, it makes a lot of sense to examine this still out-of-favor industry today as it continues to recover from the pandemic hit.

The bad news

The problem is that there's another important trend that's got even bigger implications. Put simply, oil is being replaced by cleaner energy options, notably electricity. This shift has been going on for years, but it has been gaining a lot of attention lately because of a global push to reduce carbon emissions. To be fair to oil drillers, energy transitions like this are slow. In fact, even under aggressive assumptions, oil will remain a vital energy source for decades to come. But the writing is on the wall, so to speak, and demand will likely plateau and then start to decline in the 2030s. 

XOM Dividend Yield Chart

XOM Dividend Yield data by YCharts.

Oil is a depleting asset, meaning that once a barrel is pulled from the ground it is gone forever. So drilling and exploration will be needed for years to come, even as demand declines. But it isn't clear just how profitable a business this will be if supply and demand get out of balance in the "wrong" direction. Meanwhile, if the clean energy push moves more quickly than expected, oil companies could be left with assets and investments that aren't worth what they were once believed to be worth. The impact of writedowns was on display in 2020, with Chevron taking a $1.2 billion writedown on its U.S. drilling assets. That, however, was on top of a nearly $8.2 billion writedown taken in 2019. Such write-offs aren't unusual and show that oil companies are already being forced to rethink their futures. 

Put simply, if the value of an oil company's assets isn't what the company and investors think, then even a historically cheap price may not be a bargain. Caution is in order here.

Where do you stand?

If you believe strongly in ESG investing, then most oil companies are probably a bad option for you even if you think the clean energy transition will be a long one. No price would make an oil stock a worthwhile investment. That said, the industry is offering compelling yields and is not likely to go away anytime soon. The recent price advance in oil, in fact, shows demand for it remains robust and that drillers can still turn material profits. 

That suggests that the best course of action might be to take a middle-of-the-road approach by buying integrated oil giants that have been looking to use oil profits to build out clean energy businesses, like Royal Dutch Shell (NYSE:RDS.B) and TotalEnergies (NYSE:TTE). It's a punt, but one that could allow you to take advantage of what appear to be undervalued stocks while benefiting from both the oil recovery and the long-term shift away from the fuel. But don't expect a smooth ride -- oil is a volatile commodity in the best of times, and right now is not the best of times, so it's even more volatile than usual. Oil stocks are not for the faint of heart.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.