Valero Energy's (VLO -0.95%) third-quarter earnings results made for a great example of a well-run company in a less-than-stellar industry. Even though the company did pretty much what any investor would want from the business, the environment in which it was operating has been struggling. Let's take a quick look at Valero's results for the most recent quarter and what investors can expect from here. 

Image source: Getty Images.

By the numbers

Valero ended the quarter with net income of $613 million, or $1.33 per share, a 54% decline from the same time last year. It should be noted, though, that this is an improvement over the prior quarter's $1.07 per share profit on a normalized basis. 

The largest reason for the decline in earnings on a year-over-year basis is the narrowing of refining margins across the entire industry. At this time last year, the throughput margin for Valero -- a metric that measure the difference in crude oil and refined petroleum product prices -- was $14.38 per barrel. Today, that same metric stands at $9.07 per barrel. To be fair, this time last year was a rather exceptional time to be a refiner, so it's a little misleading to only look at net income as a sign of success.

*Adjusted operating income is defined as operating income excluding lower of cost or market inventory valuation adjustment and asset impairment loss. Data source: Valero Energy earnings release.

The numbers that really matter when it comes to refining are the operational results, and this is where Valero did quite well this quarter. Total throughput volumes increased slightly, to 2.86 million barrels per day, and the company was able to lower its operational cost per barrel from $5.55 per barrel this time last year to $5.31 per barrel. This is important because with lower throughput margins, every penny counts. 

Those results translated to $863 million in operational cash flow. This is down pretty significantly from the prior quarter, but that is in part due to some changs in working capital that freed up a lot of cash. With that cash, Valero paid out $778 million in dividends and share repurchases on top of the $453 million it spent on capital improvements. For those who may be a little worried about burning through cash to pay dividends and buy back stock, just remember that Valero ended the quarter with $5.9 billion in cash on the books. Thanks to that strong cash position, the board authorized another $2.5 billion in share buybacks, continuing its streak of significantly reducing its share count over the past five years. 

VLO Average Diluted Shares Outstanding (Quarterly) Chart

VLO Average Diluted Shares Outstanding (Quarterly) data by YCharts.

From the mouth of management

The biggest story for anyone in the refining industry this past year or so has been the rapid increase in the cost for renewable identification numbers -- RINs -- needed to comply with the U.S. EPA's renewable fuels standards. Earlier this year, Valero's management said it expected to spend as much as $750 million on RIN purchases for compliance. On the conference call, CEO Joseph Gorder made sure to voice his thoughts on what he saw as a flawed compliance structure and the costs to Valero despite some of the stronger results from its business. 

In the market, we continued to see solid product demand domestically and internationally. The sustained low price of crude oil and petroleum products, along with strong export demand, helped create a pull on domestic product inventories. We're also encouraged by the modest return of domestic shale crude production, which is good for diesel demand and crude differentials. On the downside, we continue to see negative impacts on Valero's earnings from exorbitant RINs prices. For the year, we expect to incur costs in the range of $750 million to $850 million to purchase RINs. At these levels, the expense is significant to our company and has our full attention.

You've likely seen that we filed a petition with the EPA to address this issue. Our efforts are focused on moving the point of obligation, which we believe will not only level the playing field among refiners and retailers, but will also improve the penetration of renewable fuels, reduce RIN fraud, lower RIN speculation and reduce costs for the consumer. We have had many constructive conversations with regulators, and these conversations continue to today. And as you'd expect, we continue to work this issue aggressively.

What a Fool believes

Just like the last couple of quarters, the bottom-line comparison to this time last year doesn't really tell the story about Valero's third-quarter earnings. Refining margins across the entire industry have been on the decline for much of 2016, and it doesn't help that Valero is shelling out so much for RINs, either. The bright side is that despite a more challenging environment, the company continues to run its facilities at a high rate and at low cost. These are the things Valero's management can control, and it's a sign they are doing the right things. That is pretty much all you can ask from a refining company.