Oil refining has been one of the best-performing sectors of the oil and gas industry over the past year. Even though oil prices are on the rise, large refiners with access to several crude oil sources -- such as Valero Energy (NYSE:VLO) -- have been able to take advantage of crude oil price discrepancies that have translated into some of Valero's highest refining margins in years.

Here's a look at Valero's most recent earnings report and whether it will be able to maintain these kinds of fantastic results over the long haul. 

Valero's Texas City refinery.

Image source: Valero Energy Corporation.

By the numbers

Metric Q2 2018 Q1 2018 Q2 2017
Revenue $31.05 billion $26.44 billion $22.25 billion
Operating income $1.25 billion $922 million $860 million
Diluted EPS $1.96 $1.09 $1.23
Operating cash flow $2.05 billion $166 million $1.80 billion

Data source: Valero Energy earnings release.

Crude oil prices are on the rise, which is typically a bad sign for refiners. That hasn't been the case lately, though, as large, diversified refiners have been able to take advantage of price discrepancies between various types of crudes. Crude oil coming from places like the Permian Basin in Texas and the oil sands fields in Canada currently sells at a steep discount to crude oil imported from outside North America. Valero is taking full advantage of this situation by refining as much disadvantaged crude as possible.

Considering how small the contributions from its ethanol and Valero Energy Partners segments are, investors should care more about its refining operations than anything else. This past quarter, refining margin for the company was $10.80 per barrel. That was much lower than the margins its peers Marathon Petroleum and Philips 66 realized in the quarter -- these two have more ability to run heavily discounted Canadian crude -- but Valero's low-cost operations allowed it to still generate high operating income margin for the quarter. Refinery utilization for the period was down slightly to 93% as a result of scheduled maintenance in preparation for the summer driving season. 

VLO operating income by business segment for Q2 2017, Q1 2018m and Q2 2018. Shows large increase in refining.

Data source: Valero Energy earnings release. Chart by author.

After a small hiccup in cash flow in the prior quarter for some working capital builds, Valero's cash-generating ability in Q2 gave management the flexibility to buy back $327 million in stock. Even after this large stock repurchase and dividends, the company still sits on $4.5 billion in cash and equivalents.

What management had to say

In Valero's press release, CEO Joe Gorder highlighted its recent pipeline investments that were helping the company source more of these cost-advantaged crudes and realize higher margins: "We're enjoying the benefits of lower crude costs and optionality at our Memphis refinery provided by the Diamond Pipeline. Our U.S. Mid-Continent refineries are also poised to capture additional margin opportunities from increased access to Permian Basin crude oils when the Sunrise Pipeline expansion starts up in early 2019."

Also, on Valero's conference call, Gorder gave his outlook for the rest of the year, which sounded incredibly promising for investors:

Looking ahead, we continue to have an optimistic outlook for the balance of the year. Global economic activity remains healthy and product demand is strong domestically and internationally. Gasoline and distillate export volumes are steady. Days of supply of light products remain below five-year averages despite recent high industry refinery utilization rates. And while crude discounts have narrowed recently, the oil market remains well-supplied and we expect differentials to widen again as the industry enters turnaround season.

VLO Chart

VLO data by YCharts.

Is the refining business really that different these days?

Management teams at refiners are all talking about how we are in a whole new world when it comes to North American refining. Gone are the days of having to import oil at premiums to the global market and being a net importer of refined products. Instead, many of these companies can select from a plethora of cheap crude sources and have the ability to export refined products by the boatload to international markets. According to the Energy Information Administration, net exports of refined products are up to 2.8 million barrels per day, and companies like Valero, Marathon, and Phillips 66 are all investing in expanding export capacity.

These avenues of growth are something that will help improve earnings over the long haul, but investors have to keep in mind that this business is still going to be heavily dependent upon refining margins. A lot of the reason why crude oils in the U.S. are so cheap is that pipeline capacity is at its limits. As pipelines get built and producers have the ability to move crude more easily, then some of that pricing advantage refiners see today could diminish.

Quarters like this are more or less the upper limit for Valero in terms of profitability. It will be able to eke out a little more earnings from running its facilities at higher utilization rates, but margins this wide are hard to sustain for the long haul. Investors can enjoy this ride right now, but it's unreasonable to think it will last forever.

Tyler Crowe has no position in any of the stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.