Since gaining its independence in 2012, refining giant Phillips 66 (PSX -0.35%) has significantly outperformed the S&P 500, delivering a better-than-225% total return versus the approximately 100% gain of the index. One of the drivers of that outperformance is that the company has returned $12 billion in cash to investors via dividends and share repurchases. More cash is on the way because the company is putting the finishing touches on a major expansion program. As a result, Phillips 66 looks like it can continue outperforming the S&P over the long term, which makes the stock a solid buy for those seeking a lower-risk way to invest in the energy sector.

Investing to take advantage of the shale boom

One of Phillips 66's focuses over the past few years has been investing capital to take greater advantage of the surge in cheap oil and gas from shale plays. While this has included spending money to increase its ability to refine domestic oil, Phillips 66 allocated the bulk of this capital on building new midstream and chemicals projects that will grow and diversify its revenue streams. One of the largest was a $6 billion petrochemical complex along the Gulf Coast that it built within its chemicals joint venture with Chevron (CVX 1.04%) to turn natural gas into the building blocks for plastics. While Hurricane Harvey will delay the start-up of the project until early next year due to flooding, once complete, Phillips 66 and Chevron should start receiving cash distributions from the joint venture.

Refinery at twilight with a beautiful sky in the background.

Image source: Getty Images.

Meanwhile, one of Phillips 66's other investment focuses has been on expanding its midstream footprint. Over the past few years, the company built a natural gas liquids (NGLs) fractionation unit, a LPG export facility, and several pipelines, while also expanding an oil and refined products terminal it bought from Chevron, which all predominately generate stable fee-based cash flow. One of the other benefits of building these midstream assets is that the company can drop them down to its MLP Phillips 66 Partners (PSXP) in exchange for cash and units. For example, last month the company sold a stake in a recently built pipeline as well as another asset to its MLP for $2.4 billion, which consisted of $1.7 billion in cash, $240 million in units, and the assumption of debt. That enabled the company to immediately cash in on its investment while still collecting a growing stream of cash flow from its stake in Phillips 66 Partners.

Phillips 66's future midstream investments will be primarily self-funded in its MLPs, which includes not only Phillips 66 Partners but DCP Midstream (DCP). These entities already have several expansion projects underway and more in development. Phillips 66 Partners, for example, is working with DCP Midstream to expand their Sand Hills Pipeline. Furthermore, it's also investing in two other pipelines and has a project at a Phillips 66 refinery in development. Meanwhile, DCP Midstream recently signed a letter of intent to form a joint venture with two other companies to build a natural gas pipeline out of the red-hot Permian Basin. Because Phillips 66 is shifting more of the capital burden of midstream expansions to its MLPs, it will participate in their growing streams of cash flow, without tying up capital to do so, thus accelerating its cash flow growth.

A person handing over cash.

Image source: Getty Images.

Ramping up capital returns

With this funding shift well underway, Phillips 66 is starting to experience a noticeable increase in cash flow. After generating $3 billion in operating cash flow last year, the company has already produced $2.65 billion in operating cash flow through the first half of this year and ended the second quarter with $2.2 billion in cash. With more money on the way from the Phillips 66 Partners transaction and increasing cash flow from recently completed capital projects, Phillips 66 has quite a war chest at its disposal.

That's one reason why the company recently announced a new $3 billion stock buyback program. That new authorization will enable Phillips 66 to continue reducing its outstanding share count, which has already fallen more than 20% since its formation in 2012. Meanwhile, the combination of the falling share count along with its rising cash flow should enable Phillips 66 to continue increasing the dividend. It already announced an 11% increase earlier this year, which was the seventh increase since 2012, and combined they've boosted the payout by a 30% compound annual growth rate. While dividend growth won't continue to be quite so robust (the company started from a small base), it should still be meaningful, and likely in the low-double-digit range annually.

Getting back to outperforming

While Phillips 66 has vastly outperformed the market since its spin-off in 2012, it has fallen short over the past year due to some challenges in the refining sector. That said, with its major expansion projects starting to generate cash flow, and shareholder distributions ramping up, the company appears poised to resume its outperformance, especially if the market takes a breather. Investors who are looking for an energy play should consider buying Phillips 66.