It's never fun when you do what you say you're going to do and get criticized anyway. That's probably how John Christmann III, CEO of oil and gas industry player Apache Corporation (NASDAQ:APA), feels after the stock market beat down Apache's shares more than 8% on Thursday, after the company reported an adjusted second-quarter loss of $0.21 per share and lowered its production guidance for this year and next.

But despite how bad it may seem, there were some bright spots in Apache's report, and with the stock now trading near its 10-year lows, a strong case can be made for buying in at these prices.

A row of oil and gas pipelines stretching into the distance.

Oil driller Apache has been making infrastructure improvements at its Alpine High field and in the North Sea, in the hopes of outperforming in future quarters. Image source: Getty Images.

The raw numbers

When you compare Apache's major Q2 2017 numbers with its Q1 2017 numbers, things don't look good, with the exception of cash flow, which showed remarkable improvement. Even compared with its Q2 2016 numbers, production is still in decline:

 Metric Q2 2017  Q1 2017  Q2 2016 
Oil production (barrels per day) 242,761  253,885  285,005
Total production (barrels of oil equivalent per day) 460,293 481,110 535,456
Adjusted earnings (loss) per share ($0.21) $0.56 ($0.26)
Operating cash flow $751 million $455 million   $744 million

Data source: Apache quarterly reports and SEC filings. Chart by author.

With numbers like that, it's no wonder the market gave Apache shares an 8% haircut. But besides cash flow, there were some bright spots in the numbers, too. The company's cash on hand has gone up every quarter for the past year, from $1.2 billion in Q2 2016 to $1.7 billion today. Likewise, the company's total debt has fallen slightly, from $8.7 billion in Q2 2016 to $8.5 billion today. Quarterly revenues were essentially flat year over year at $1.4 billion. Operating expenses fell from $1.7 billion in the year-ago quarter to $1.4 billion in Q2 2017.

But the company also made a major adjustment to its production projections for Q4 2018, cutting them from a high estimate of 537,000 barrels of oil equivalent per day (boe/d) to a high of just 487,000 boe/day. That sounds alarming, until you hear the reason why.

Behind the numbers

The biggest problem for Apache this quarter was that the numbers couldn't tell the whole story, presenting an inaccurate picture of a company with declining production, diminishing earnings, and lowered prospects for the future. But you need to hear, as Paul Harvey used to say, the rest of the story.

Apache has been predicting lower production in Q2 for months, in large part because of scheduled maintenance downtime in its North Sea operations, where it was installing a subsea tieback for its new Callater field. That work was completed ahead of schedule, but it still resulted in a 43% year-over-year reduction in North Sea natural gas production and a 53% year-over-year reduction in North Sea natural gas liquids production. The tieback is now installed, and oil and gas are flowing.

In addition, production at the company's big Alpine High find in West Texas has been slowed as the company builds out critical infrastructure in the region. Much of that infrastructure is expected to come online in Q3 2017. The company's adjusted Q2 production was actually higher than management anticipated, at 405,989 boe/d, compared with the projected 376,000 to 386,000 boe/d. 

As for lowering future projections, that's the result of one of Apache's most brilliant moves in 2017 -- the sale of its Canadian assets. The company's non-Permian Basin North American operations -- which included Canada -- were among its least profitable, with an average margin of just $11/boe in Q2, compared with an average $17/boe from its Permian operations and $28 to $29/boe for its overseas operations.

So even though overall production will be lower than expected in future quarters, the margin on that production should be higher, which benefits the company and its shareholders. Not to mention that the $715 million the company received for its Canadian assets and the reduced expenses that result from the sale will also help the bottom line. 

What management had to say

Christmann put another positive spin on the numbers:

Today, through the combination of expected cash flow from operations and proceeds from recent asset sales, we have the ability to fund our 2017 capital expenditures and dividend program without utilizing our balance sheet. Our $3.1 billion capital program remains unchanged, and relative to year-end 2016, we expect to end 2017 with more cash, less debt, and significantly higher production levels in the Permian Basin.

Investor takeaway

It's interesting to compare where Apache was a year ago with where it is today. A year ago, the company hadn't yet announced how absolutely massive its Alpine High find was. It had a bunch of low-margin Canadian assets on its books. The average price it was getting for a barrel of oil was $43.14. Today, investors know about Alpine High and its potential, the underperforming Canadian assets are gone, and Apache's average per-barrel oil sale price in the last quarter was $46.89. 

Yet the company's stock is now 13.2% cheaper than it was a year ago. That just doesn't make sense, and if management is correct in its projections -- which it has been so far -- now seems like an excellent time to scoop up some shares.

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.