There's a legend out there that says if you want to be a successful investor in the energy space, you need to know where oil prices are headed and make investments based on those price swings. Nothing could be further from the truth. Yes, oil and gas prices will probably have a pretty significant impact on share prices, but that doesn't mean investors need to bet all their chips on the undulating waves in the commodity market.

Instead, let's examine some of the things you should look for when building a portfolio of oil stocks that will help guide you in your investment-making decisions, as well as look at a few companies that fit the bill

Finding those economic moats that no one wishes to cross
There are several different sub-industries within the oil and gas sector, and many people fret about which sectors to invest in: Is today a better time to buy refiners? Or maybe pipelines? What about producers? Instead of racking your brain about these sorts of things, look for the competitive advantages the company has within its respective sub-sector. For example:

  • Producers: What kind of production potential does the company have? Is it good at replacing its production with new reserves? Can it control costs?
  • Refiners: Do its facilities have some sort of geographic advantage? What efforts is it taking to exploit inefficiencies in the price of crude oil and refined products?
  • Pipelines: Does its pipeline network provide services to places with growing or depleting production? Does its system have dominance over a particular geographic area?
  • Oil and gas equipment and services: Does the company have strong market share in a particular service? How is that market share dominance preserved?

Answering these sorts of questions will go a long way in identifying the best companies to buy in their respective sub-industries, and knowing the answers to these questions could help you avoid the mistake of taking any rash or panicked action when oil prices hit the fan.

Can those economic moats actually create cash for shareholders?
It is really, really hard to justify the purchase of an energy company that can't create consistent free cash flow. Oil production is a fickle thing. From the moment a company brings a new well online, the production from that well starts to decline. This leads to immense amounts of capital expenditures to find, appraise, develop, and ultimately extract oil, all just to replace the amount a company had previously pulled out of the ground.

While producers are burning through capital for these new sources, they're also burning through the capital of the others around them. Equipment provided to them by services companies will need to be replaced. A certain type of oil coming out of the ground means refiners need to invest in new processes to handle the unique chemistry of that particular crude. Drill bits wear, and pipes need maintenance to prevent leaks. All of this leads to hundreds of billions of dollars globally spent on keeping the oil industry's engine running.

For a company to truly be worth its salt in this industry, not only does it have to generate enough cash to meet these high costs, but it also needs to produce enough excess cash to either grow the business or reward shareholders with dividends or share repurchases.

Companies that can generate loads of free cash flow from its operations -- especially those that can do so through the ups and downs of the commodity cycle -- are the true gems of the industry. If you can find a small handful of companies that have both a solid economic moat and the free cash flow to show from it, then you're well on your way to building wealth over the long term.

A few companies for your consideration
I'll admit, I'm a little biased to these three companies -- I'm a shareholder or plan on being one soon for all three of these. But I've bought them for a good reason: They meet the criteria I've mentioned.

ExxonMobil (XOM 0.23%): This, the largest oil company, is an incredibly disciplined capital allocator and has been very friendly to shareholders through a consistent dividend and tons of share repurchases. This past year alone, the company generated more than $10 billion from its operations in excess of capital expenditures. Gobs of cash like that have allowed the company to repurchase more than $230 billion worth of its shares in the past 10 years. That's more than the entire market cap of Chevron, the second largest publicly traded oil company.

Magellan Midstream Partners (MMP): Magellan's network of refined petroleum product pipeline -- gasoline, diesel, and the like -- is so large, parts of it are regulated like a utility because it is completely devoid of competition. This network of pipes brings in loads of fixed-fee revenue that is scantly dependent on oil prices, making budgets and cash flows pretty predictable for management to pay shareholders with a dividend that has grown 12% annually like clockwork for the past 14 years.

National Oilwell Varco (NOV 0.64%): If you're going to build equipment for the oil and gas industry, what better way to do that than build standardized equipment that will pretty much ensure customers will be coming back for decades for replacement parts? Thanks to National Oilwell Varco's strategy of acquiring smaller equipment suppliers, integrating their technology, and standardizing it into the company's larger systems, it has gained control of 80% of the market for drilling packages on offshore rigs. These things have enabled the company to generate cash from operations more than triple its capital expenditures over the past five years.

What a Fool believes
It doesn't take a genius to be a successful investor in the energy space. You don't need to be able to analyze the entire global oil market and determine which way the wind is blowing. You just need the stomach to ride out the rough seas when oil prices go on their pretty routine fits. Finding the comapnies that can reward you with excess cash flow throughout the commodity cycle will certainly help ease some of the concerns related to investing in this space and will probably be your best bets to be successful when building a portfolio of oil stocks.