As New Year's Eve quickly approaches, and we prepare to make our 2013 investing resolutions, it is a good time to reflect on the energy sector in the year that was 2012.

In this December series, our writers will be recapping some of the most popular, highest-performing stocks in this sector. We will examine whether the gains these companies provided their shareholders in 2012 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 will take a look at Marathon Petroleum (MPC -3.67%) and see how the refiner performed this year and what prospects hold for its future.

The year that was 2012
From the start of this year, Marathon's stock has been up a fabulous 88.6%. The S&P 500, in the same period, rose 13.3%. The first question investors might be asking is whether this kind of a gain is justified. Refiners, after all, historically have been considered lousy businesses to run. Rarely have they been on even terms with their more popular upstream cousins. Being regularly subject to volatility in crude oil feedstock (i.e. input) costs and downtime of refineries, Mr. Market has generally underappreciated the downstream segment. However, 2012 proved to be different, and with reason.

The Ohio-based Marathon put up a solid performance both operationally as well as from a financial standpoint. Best of all, this company has been investor-centric by returning cash to share-holders.

Advantage: Marathon
From an operational perspective, Marathon's strategically located refineries proved to be an operational advantage. Most of its refineries source the cheaper West Texas Intermediate (WTI) variants as feedstock. Compared to the internationally traded Brent benchmark, the WTI has been way cheaper. Currently, the WTI trades at a discount of $21 per barrel to its Brent counterpart.

Throughout 2012, the Brent-WTI spread hovered in the mid-teens to the early twenties, and this has been a boon to midcontinent refiners like Marathon, HollyFrontier (HFC) and Western Refining (WNR). Compared to the likes of Valero Energy (VLO -2.86%) which sources most of its crude feedstock at Brent pricing, these refiners enjoyed higher gross margins.

Marathon also diversified its refining network. Its acquisition of BP's (BP -1.17%) 451,000 barrels-per-day (bpd) Texas City refinery is a strategically well-placed move. With this, Marathon's total refining capacity in Texas shot up to 531,000 bpd. For the record, Texas is home to the promising Eagle Ford and Permian Shale plays. Which is why increasing refining capacity near producing basins should eventually turn out to be a master stroke from management. From this acquisition, Marathon expects earnings per share to move up between 13% and 27%. Now that's just brilliant.

The company also completed its Detroit heavy oil processing facility in November. This refinery is in the right location to access the heavy bituminous crude from Canada. In the long run, having refineries situated close to producing fields should bring down operating costs to a large extent.

Financially sound
Currently sitting on a cash pile of nearly $3.4 billion, Marathon has ample opportunities for expansion or to return cash to shareholders. Free cash flow in the last 12 months stands at an awesome $1.26 billion. This year, the company returned a little over $1.2 billion to shareholders in the form of dividends and share repurchases. Additionally, management has created a master limited partnership by creating MPLX (MPLX 0.55%) for its pipelines and transportation segment. A sure way to return cash to shareholders, this investment vehicle is expected to create an 80% tax shield until the end of 2015.

Looking ahead
Earlier this year, I wondered if Marathon was poised for a turnaround. Well, it turned out to be true. Now the question is: Is this growth sustainable? The answer, I believe, is yes.

While the domestic shale oil industry is exploding, the heavier and sour Canadian crude oil might well make its way across the border. Marathon is well-positioned to process both. The refiner's forte lies in a well-balanced crude slate to refine both sour and sweet crude. Of the total refining capacity, 52% is devoted to process sour crude while the rest 48% for sweet crude oil.

The company also has enough resources to make further acquisitions. At the same time, I believe, management can be trusted as far as value-added acquisitions are concerned.

Foolish roundup
The next year and the following years should be a continuation of the good work done so far. Marathon Petroleum's robust growth should continue.