There has been considerable concern about companies with lots of assets in the Houston area following the flooding wrought by Hurricane Harvey. But based on Valero Energy's (VLO -1.65%) most recent results, it doesn't look like it was that big of a deal. The company posted 50% net income gain compared to last year thanks to a more favorable refining market.

Here's a rundown of Valero's most recent results. 

Oil refinery at twilight.

Image source: Getty Images.

By the numbers

Metric Q3 2017 Q2 2017 Q3 2016
Revenue $23.56 billion $22.25 billion $19.65 billion
Operating income $1.34 billion $871 million $892 million
Diluted EPS $1.91 $1.23 $1.33
Operating cash flow $1.04 billion $1.34 billion $863 million

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

In the prior quarter, Valero started to benefit from an improving refining market. During the most recent quarter, the market continued to bounce back, leading to impressive results. Higher demand from the summer driving season and a substantial difference between the prices of various crudes lifted refining margins to $10.94 per barrel, which was up from $8.72 per barrel compared to the prior quarter.

Valero did all it could to take advantage of the favorable market by running its facilities at a utilization rate of 92%. That doesn't sound great when its peer Marathon Petroleum (MPC -0.84%) ran its refineries at 102% this past quarter, but Valero also had to temporarily shut down five of its refineries because of Hurricane Harvey. 

Valero reports about two other business segments -- ethanol and Valero Energy Partners (NYSE: VLP) -- but they don't matter that much when compared to the refining business. 

Valero operating income by business segment for Q3 2016, Q2 2017, and Q3 2017. Shows a $500 million gain for refining while ethanol and Valero Energy Partners were mostly flat.

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

Also somewhat encouraging about these most recent results is that all four of the company's refining regions performed well. The only aspect of the refining business that didn't swing Valero's way were the compliance costs for U.S. Environmental Protection Agency renewable fuel standard, which came in at $230 million.

Valero adjusted operating income by refining region for Q3 2016, Q2 2017, and Q3 2017. Shows steady gains across all four regions.

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

Valero generated $1 billion in cash from operations. That's lower than the prior quarter, but it did involve a large working capital build. With that cash, management repurchased 4.2 million shares for $291 million. Even after doling out all that cash for share buybacks and dividends, the company had $5.2 billion in cash and short-term investments on the books.

What management had to say

Now that Mexico has rewritten some of the regulations for the oil industry there, several companies are making aggressive pushes into the country. As part of his press release statement, CEO Joe Gorder highlighted some of the opportunities facing Valero.

We are making excellent progress on our growth investments, with the Wilmington cogeneration plant and Diamond Pipeline expected to be online in December. We are also pleased with the progress of our investments in Texas and expansion into Mexico, which will extend our product supply chain, internalize secondary costs, and provide opportunities for third-party revenue growth.

What a Fool believes

Gorder had mentioned on previous conference calls that the conditions were ripe for a recovery in the industry, and it looks like he was right. As is the case with the refining industry, though, the market can turn on a dime. For investors looking at Valero long term, the focus should be on its ability to keep its refining costs low and create value for shareholders with dividends and share repurchases. As long as the company can maintain them, investors should be happy.