A year ago, investing in oil and gas was about the furthest thing you could get from a "no-brainer." Oil prices seemed stubbornly stuck below $50/barrel, which meant a lot of companies weren't even breaking even on the oil they were producing.

Fast forward to today, and the environment couldn't be more different. American energy production is up -- way up -- as oil and gas prices have recovered. The industry's belt-tightening during the oil price downturn is now paying off in the form of higher margins and big profits. 

It seems like a great time to buy in, but you still shouldn't buy just any oil and gas stock. Luckily, it doesn't take a genius to identify great choices in the oil and gas industry, such as Apache Corporation (APA 0.97%)Devon Energy (DVN 0.98%), and Royal Dutch Shell (RDS.A) (RDS.B). Here's why they're such no-brainer investments.

A natural gas fracking rig at sunset.

The oil and gas industry has taken investors on a wild ride over the past several years. Image source: Getty Images.

A longtime laggard

In spite of the oil price slump of 2014-2017, many oil and gas companies have actually seen their stock prices rise over the past three years. Royal Dutch Shell, for example, is up 15.3%. On the other end of the spectrum, there's independent oil and gas exploration and production company (E&P) Apache Corporation, which is sitting on a 24% loss.

Some of that loss is justified: Hurricane Harvey hit its Houston headquarters hard. That may sound like a tongue twister, but what really got twisted were Apache's development plans for its massive "Alpine High" play in the West Texas portion of the Permian Basin. If you're not up on oil and gas development sites, the Permian Basin is one of the hottest shale plays in the country right now.

When Hurricane Harvey struck Houston, it damaged some third-party equipment manufacturing facilities that were making necessary Alpine High equipment. With the equipment delayed, Alpine High output couldn't come online as fast as the company had predicted. That meant lower-than-expected production numbers -- particularly after the company sold its underperforming Canadian assets -- which sent investors fleeing the stock for fear that the company wasn't going to be able to capitalize on high oil prices as fast as its peers. About the only thing Apache had going for it was its best-in-class dividend yield, which is currently 2.3%.

There's good news, though! Alpine High is now not only online, but on a tear. In Q1 2018, the play delivered 33% more oil and gas than in the prior quarter. That helped Apache achieve record Permian Basin production of 183,000 barrels of oil equivalent per day, up 24% year over year. And as Apache continues to develop the site, its bottom line should continue to improve. The market seems to finally be catching on, bidding up Apache's shares by double digits over the past month alone. But thanks to the huge hit the company's stock had taken, there should still be plenty of room for this underappreciated stock to run.

Same story, different ticker

Devon Energy's story is similar to Apache's. Also an E&P, Devon's share price is down 29.3% over the last three years. And thanks to some bad production numbers in Q4 2017, the company has lagged its peers in recovering. But for Devon, the cause of those bad numbers wasn't Hurricane Harvey. Instead, Devon's partners were late in bringing 50 wells online, plus it experienced unplanned downtime for maintenance at one of its Canadian processing facilities. 

Like Apache, though, those issues proved to be temporary, and the company's most recent quarter, Q1 2018, was stellar from both a financial and a production standpoint. Oil production was near the high end of the company's guidance at 251,000 BOE/D, and operating cash flow was up 11% over the prior quarter to $804 million.  

Devon is also taking a play from Apache's book and selling off some underperforming assets to raise cash. In early June, for example, Devon announced it was selling its stake in EnLink Midstream Partners and EnLink Midstream to a private equity firm for $3.125 billion in cash. But instead of putting the cash toward a Permian Basin buildout, management plans to use it to buy back shares, which are currently trading at a deep discount to its peers. 

Like Apache's, Devon's shares have recovered somewhat over the past month as investors have caught wind of the company's hot Permian prospects and the likelihood of share repurchases. Unlike Apache, though, Devon's dividend yield is a paltry 0.6% right now. But still, the company represents a rare no-brainer buying opportunity.

And now for something completely different

From the rough-and-tumble world of E&Ps, we head straight to the glamorous, big-money world of the oil majors: specifically, Royal Dutch Shell. Like many of its oil major peers, Shell was better able to weather the energy price slump thanks to its downstream (refining and marketing) operations, which are less affected by oil prices than upstream (exploration and production) operations. 

Still, like its smaller industry colleagues, Shell made a concerted effort to get its production costs under control during the downturn. And, similarly, it's now reaping big rewards as high oil prices and low production costs combine to juice its bottom line. In its most recent quarter, Shell increased its net income by 54%, and its operating cash flow by 29.6%, over the prior quarter. And its dividend -- like Apache's, best in its class -- is now 5.5%, more than twice Apache's! Size, after all, has its perks. 

But should you be concerned that the ship has already sailed on a Shell investment? After all, its share price recovery is already well under way while Apache's and Devon's aren't. Not to worry: Shell's valuation metrics such as its price-to-earnings ratio and its enterprise value-to-EBITDA ratio are in line with -- and in some cases, the lowest among -- its Big Oil peers. 

Given Shell's positive outlook and stellar recent performance -- not to mention its best-in-class dividend -- Shell looks like a no-brainer of a buy.

Because you have a brain

When a company with good prospects and outstanding recent performance is selling on the cheap, it probably seems like a no-brainer investment. However, it's important to look closely before you buy and make sure that there isn't some hidden problem. Luckily, in the cases of Apache and Devon, it looks like the market is just slow in catching up to their improved fundamentals. For Shell, the market may have already caught on, but it's still trading at a reasonable value.

Brainy investors should feel comfortable putting money into any one of these no-brainer investments.