Who would have thought that the best investment in oil and gas last year would be refining companies? By most accounts, rising crude oil prices should narrow margins and make for lean times in the industry. That wasn't the case, though, as Valero Energy (VLO -0.32%) and others posted surprisingly strong results in the second half of the year.

This past quarter, Valero reported a blowout quarter that was more than six times the prior year's result. While the quarter was good, it wasn't that good. So let's dig into the numbers for this quarter and get a feel for what investors can expect from Valero for the rest of 2018. 

Oil refinery at night.

Image source: Getty Images.

By the numbers

Metric Q4 2017 Q3 2017 Q4 2016
Revenue $26.39 billion $23.56 billion $20.71 billion
Operating income $853 million $1.34 billion $620 million
Diluted EPS $5.42 $1.91 $0.81
Operating cash flow $1.66 billion $1.04 billion $998 million

Data source: Valero Energy earnings release. EPS = Earnings per share.

Refining is one of those industries with high tax rates because of relatively low depreciation expenses and few tax breaks. So the recent change to the corporate tax rate to 21% is a profound change for Valero. This past quarter, the company realized a $1.6 billion net tax benefit because these tax law changes reduced the company's overall deferred tax liability. That makes this quarter look much better than what should be considered a relatively decent quarter. Adjusting for this one-time tax benefit, Valero reported a respectable $1.16 per share.

Management likes to report its earnings in three segments -- Refining, ethanol, and its interest in Valero Energy Partners (NYSE: VLP). It may be an accurate description of how management views the business, the thing that matters to investors is how its refining segment does because it represents the bulk of its earnings. 

VLO operating income by business segment for Q4 2016, Q3 2017, and Q4 2017. Shows year over year decline for ethanol more more than offset by gains for refining and valero energy partners.

Source: Valero Energy earnings release. Chart by author.

The third quarter of 2017 was an excellent quarter for refining margins. The hurricanes that hit the Gulf Coast region temporarily shut down some facilities and also increased total gasoline demand. So to expect another quarter like that seems a bit much. Still, Valero posted a respectable refining result as its utilization rate was 96% and its operating expense was just $3.55 per barrel.

Valero's strongest segments continue to be its operations in the U.S. Gulf Coast. Its Gulf Coast operations benefit from its massive scale (1.8 million barrels per day of capacity) and its ability to realize higher prices on exports. Mid-Continent results were also much better this past quarter, but that was almost entirely from higher refining margins. Valero's West Coast operations are still the laggard of the business as management has struggled to reign in per barrel costs relative to the rest of the company.

VLO adjusted operating income by refining region for Q4 2016, Q3 2017, and Q4 2017. Shows declines sequentially, but substantial year over year gains for the Gulf Coast and Mid-Continent regions

*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. Chart by author. 

At the end of the quarter, Valero had $5.8 billion in cash on hand and $8.8 billion in total debt. With cash from operations on the rise even before the changes to the tax code take place, the company has a lot of walking around money.

What management had to say

Here's part of CEO Joe Gorder's high-level overview for the coming year and what Valero intends to do in 2018.

Looking ahead, we continue to see a favorable fundamental environment, with abundant crude oil supply and strong products demand being supported by global economic growth. We're also encouraged by the potential benefits to the refining industry from Tax Reform and the reduction in the global limit for fuel oil sulfur.

With a lower tax burden in 2018 resulting from Tax Reform, we expect to see a significant benefit to Valero's net cash provided by operating activities.

Before this earnings release, Valero's Board of Directors approved a 14% increase to its regular cash dividend as well as authorization for management to purchase an additional $2.5 billion in stock on top of its existing share repurchase authority. As it stands, management can buy back $3.7 billion of the company's stock under the current buyback program.

What a Fool believes

With refining margins holding steady in the face of rising oil prices and the impending changes to the U.S. tax code, Valero is looking better and better by the day. The company has a suite of investments to increase its presence in Mexico, expand refined product exports, and improve its crude oil sourcing for some of its refineries. That may not sound like much in terms of organic growth, but the company's ability to throw off so much free cash flow that management rewards shareholders with it makes for a relatively decent value proposition.

With a dividend hike on the way and authority to repurchase 8.7% of the company's market capitalization with share buybacks, there is a good chance that 2018 is going to be a good year for Valero's shareholders.