With just a few hours left to bid adieu to 2012, and as we prepare to make our 2013 investing resolutions, it is a good time to reflect on how the energy sector performed this year.

In this December series, our writers have recapped some of the most popular, highest-performing stocks in this sector. We examined whether the gains these companies provided their shareholders are sustainable, or whether they merely can be attributed to one-time events or fizzling trends. Consider these pieces as gifts to benefit our Foolish, long-term investors seeking exposure to the energy sector. Enjoy, and Fool on!

Today, we've reached the end of the series, and we'll cap it off by taking a look at independent refiner Western Refining (WNR). The stock has been up a massive 95%  year to date. And there doesn't seem to be any indication of a slowdown.

So, what's driving the stock? Is this sustainable, or is the stock price pushed up by market-driven sentiments without any meaningful underlying fundamentals? Let's take a look.

Looking back at 2012
From an operational standpoint, there hasn't been any extraordinary change, from the previous year. The company operates two refineries, a 128,000 barrels-per-day refinery at El Paso, and a 23,000-bpd refinery at Gallup in New Mexico. Total refinery throughput (which is intake of feedstock) and refinery production, grew a modest 5% . Additionally, turnaround and maintenance expenses ate into the profits.

Below is a table that summarizes the refining gross margin per barrel for five refiners in the first nine months of 2012, which is the latest data available. Also, shown is the percentage change in gross margin from the corresponding period in 2011:

Company

Refining gross margin per barrel in 2012 

(in $)

Refining gross margin per barrel in 2011

(in $)

Percentage change

Western Refining

17.90 

20.30

(11.8%)

Marathon Petroleum (MPC -0.26%)

12.32 

11.59

6.3%

Phillips 66 (NYSE: PSX)

13.34 

10.62

25.6%

Valero Energy (VLO -0.32%)

10.51 

11.65

(9.8%)

Tesoro (ANDV)

17.11 

16.53

3.5%

Source: Company filings; Author's calculations.

While Western's gross margin is commendable when compared against its peers, the year-over-year comparison disappoints with a 12% drop. Turnaround and maintenance expenses, as well as cost of products sold, increased disproportionately when compared to 2011.

So what's been driving the stock?
However, what's turned out to be the biggest advantage? The locations of Western's refineries. The refiner could get its hands on the cheap midland West Texas Intermediate, or WTI, crude oil as feedstock. Throughout the year, the WTI traded at a discount range between $15 and $22 per barrel compared to the internationally traded Brent.

Additionally, the El Paso refinery has direct access to crude oil from the Delaware Basin (which is a part of the Permian Basin). This means that Western does not even have to source its crude oil supply from Cushing, Okla., WTI's storage hub. This direct source of crude oil from the Permian Basin, known as WTI Midland, is another $5 to $6 cheaper than WTI Cushing on a per-barrel basis. That's where Western has been taking advantage.

According to management, even if the Brent-WTI differentials were to fall to $10 per barrel after 12 months, the company stands to make a handsome return.

Make hay while the sun shines
In the meantime, management is beefing up its gathering and distribution network for wholesale and retail segments. To take further advantage of the crude price differentials, the company is planning construction of storage tanks totaling 210,000 barrels. Also, a dedicated 100,000  bpd of Bone Springs/Avalon shale oil supply for the El Paso refinery is in the pipeline.

Looking ahead
Other than these, pipelines and other distribution networks in the retail and wholesale segments are being developed. Management has its sights set on spinning off a master limited partnership , or MLP. This could unlock immense value for the company as well as its shareholders. Foolish investors must keep a close eye on such possible developments.

The company's balance sheet looks pretty sound with over $500 million in cash and a reduction in debt levels. Current debt-to-capital stands at about 50%. This makes an MLP prospect more of a reality.

All said, the market must have definitely taken into account all these factors. However, from an investor's perspective, I don't think it's time to panic yet. There sure looks more upside and exciting times ahead for this independent refiner. To ensure that you do not miss out on any developments on Western Refining, you can start watching the company by adding it to your watchlist.