Oil Refinery Sunset

Image source: Getty Images.

What happened

Shares of Western Refining (NYSE:WNR) posted a 19% gain in August. The largest culprit for the large share price gain were second-quarter earnings results that were down from the prior year but well ahead of Wall Street's expectations for the quarter. It also helped that refining margins in the past few weeks have started to increase, which suggests that third-quarter results will be better than the prior quarter's results. 

So what

Over short-term periods, so much of a company's stock performance can come down to how earnings compare to expectations rather than the actual earnings themselves. This past quarter, Western Refining benefited from this situation as Wall Street was underestimating the company's ability to generate results now that it has completely consolidated its acquisition of refiner Northern Tier Energy. When the company reported earnings on Aug. 2, consensus earnings estimates were expecting EPS of $0.59. Western beat these results handily by posting GAAP results of $0.70 per share. That was the big catalyst for the first few days of the month. 

Western Refining's stock was also helped by the fact that refining margins across the U.S. have improved over the past few weeks. According to the Scotia Howard Weil weekly refining indicators report, refining margins in the Gulf Coast region have improved considerably in the past few weeks, and Mid-Continent margins are on the upswing as well. For Western to realize the benefits of this situation, those refining margins need to at least remain steady or improve. After an incredibly tough first two quarters for refining companies, though, any sort of improvement is a win. 

Now what

An earnings beat and improving margins for a few weeks aren't enough evidence to build a long-term investment thesis on, but Western Refining has shown over the past few years that it is rather effective at generating high per-barrel margins at its refineries and decent rates of returns for its investors. Now that the Northern Tier acquisition is complete, management has shifted gears a bit from share buybacks to debt reduction, something that should pay off in the long run.

Tyler Crowe has no position in any stocks mentioned. You can follow him at Fool.com or on Twitter @TylerCroweFool.

The Motley Fool has no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.