Want to avoid mediocre returns in your portfolio? Then why invest in mediocre companies? To invest successfully over the long term, you must buy the best companies with distinct competitive advantages that will generate solid returns for years or even decades. 

In the world of oil stocks, some clear competitive advantages can help a company get ahead, but there is one thing the best oil companies do better than others. Let's take a quick look at this competitive advantage and what it takes to secure it in the oil market.

The best competitive advantage: The ability (and vision) to invest through cycles
If you need a reminder that oil is a commodity, check out this chart of the inflation-adjusted price for a barrel of oil since 1861.

Source: BP Statistical Review of World Energy and the U.S. Energy Information Administration; chart by author.

For the last 150 years, it has been more likely than not that the price of oil would move 10% or more in a year, with an annual price movement in excess of 50% once every dozen years or so. Clearly it's no easy feat to gauge where the oil market is going in any given year. To make matters worse, most oil and gas investment decisions must be made years in advance because of the work needed to get that first barrel of oil flowing.

This basically means almost no company in the oil business can make snap investment decisions based on the price of petroleum over the next couple years. Instead, the great companies in the space are prepared to invest no matter the current price environment. Yes, some will trim spending at the margins or perhaps delay a couple projects that are a long way off and aren't eating into current capital spending, but overall their work plans are reasonably steady from year to year no matter how oil and gas prices look today. 

Steady investment is crucial because of the physical properties of an oil and gas well. From the moment that first barrel is pulled from the ground, the reservoir that supports the well is in decline, so you need an adequate backlog of new reservoirs in order to maintain production levels. Here's a great example from Chevron's (NYSE: CVX) latest analyst day presentation. From 2014 to 2017, the energy giant estimates it will lose 135,000 barrels per day of production from its existing base of output.

Source: Chevron Investor Presentation

If today's oil prices were to scare off Chevron from investing in the future, its production would be 5.2% lower in two years than what it is today.

The foundation to make it possible
It's all well and good to say a company should invest through the commodity cycle. The real challenge is putting the wheels to the road. Here are three key components successfully investing throughout the cycle. 

  1. Strong cash flow: Since this is a capital-intensive business, a lot of cash must be coming in the door to support companies' spending habits. Ideally, you want a company that can pay for all of its capital expenditures, as well as a dividend with the cash that comes in from operational cash flow, even during the lean times of the commodity cycle. The less reliance on debt or equity issuances to fund these things, the better. 
  2. Diversified revenue stream: Companies that rely too much on a single aspect of the oil market for their revenue are much more vulnerable to big swings in profitability than those with diversity baked into their operations. For example, a refining company should strive to diversify its oil-sourcing options instead of banking an entire refinery's success on oil from one particular location. Companies with a wider range of revenue options have a better chance of success during low points in the commodity cycle.
  3. Disciplined management: Just like investors who need to avoid freaking out when share prices plunge or getting overly excited during a bull market run, management at great oil and gas companies needs to keep an eye on the horizon and maintain steady investment levels through the good and bad times. If management gets too ambitious during a high point in the oil market and commits significant levels of capital spending on new projects to grow production, it normally will be overburdened with capital obligations during the lean times. Conversely, if executives excessively put off spending during the lean times, they will be stuck with a lack of development projects to capture value when prices pick back up. 

What a Fool believes
If you are investing in oil stocks, you are hopefully doing it over the long term based on energy's central role in fueling a growing global population and a burgeoning middle class -- and not trying to ride the waves of rising and falling oil prices. Riding the waves is just too hard. If you need a reminder, consider whether we could have foreseen current oil and gas prices three to five years ago.

To invest in those long-term market trends, you need companies that have staying power. The ability to invest through the commodity cycle thanks to strong cash flow, a diversified revenue stream, and disciplined management will go a long way in letting an oil stock stick around for a long time, and investors should look for these traits when buying oil stocks.