Image source: Getty Images.

Raise your hand if you expected that midstream general partner ONEOK (NYSE:OKE) would be the top-performing large-cap energy stock this year.

My hand isn't up, and I'll bet most who follow the industry closely didn't tap it as their top pick this year, either. In fact, I'd be willing to bet that few expected that the five best-performing large-cap energy stocks would be ONEOK, Continental Resources (NYSE:CLR), Targa Resources (NYSE:TRGP), Spectra Energy (NYSE:SE), and Halliburton (NYSE:HAL):

OKE Chart

OKE data by YCharts

Here's a look back at what fueled these surprising success stories.

The long road to recovery

ONEOK's success in 2016 was partially due to its poor performance in 2015, when the stock got cut in half over concerns about its direct exposure to commodity prices, which were in a tailspin. Investors worried that the company's MLP, ONEOK Partners (NYSE:OKS), which earned a quarter of its cash flow from commodity-price sensitive activities in 2015 and supplies all of ONEOK's income, might need to cut its payout to stay afloat. While both companies reassured investors in late 2015 that they could maintain their respective payouts in 2016 and didn't need to access the equity market to fund growth, investors didn't buy that outlook. However, thanks to improving commodity prices and new fee-based assets entering services, ONEOK Partners' results have exceeded expectations. Those solid results lifted the cloud of uncertainty surrounding both companies, which sent their shares soaring in 2016.

The sum of all fears failed to materialize

Bakken Shale-focused driller Continental Resources experienced a similarly severe decline in 2015, with its stock sinking 40% because of falling oil prices and the company's weak financial condition. Times were so tough that Continental Resources had to cut its capital budget by 66% in 2016 compared with the prior year. The driller initially intended to spend only $920 million on drilling new wells, which would match expected cash flows at $37 oil. However, that capital wouldn't provide the company with enough money to drill the necessary wells to overcome production declines from legacy wells. That led it to project a drop in production from 221,700 barrels of oil equivalent per day (BOE/d) in 2015 to an estimated average of 200,000 BOE/d in 2016.

However, a combination of rising oil prices, increased well productivity, and falling costs enabled the company to produce more oil than expected. In fact, it currently estimates that production will average between 215,000 and 220,000 BOE/d this year. While the company did boost spending by $180 million, it's generating plenty of excess cash flow for debt reduction. That surprisingly strong performance drove investors back into the stock that they initially feared might go belly-up.

Image source: Getty Images.

Completing the combination

Targa Resources was coming off an even more abysmal showing in 2015, ending that year down nearly 75%. Driving the decline were worries about the company's direct exposure to commodity prices and its weak balance sheet. To address those fears, Targa announced in November 2015 that it would acquire its MLP, Targa Resources Partners, in a deal that would improve the combined entity's cost of capital and reduce leverage over time. The company closed the agreement this past February and quickly captured opportunities to shore up its balance sheet by raising $1 billion in preferred equity and another $250 million in common equity. Those transactions, plus improving commodity prices, put Targa Resources back on solid ground, which gave investors confidence it would be just fine.

Catching the eye of a suitor

Spectra Energy also endured a tough 2015, slumping more than 30%. However, that was due more to market fears than any underlying issue at the natural gas pipeline company. Instead, Spectra was on pace to deliver consistent dividend growth over the next few years because of its substantial backlog of fee-based pipeline projects. That growth visibility at a discounted price caught the eye of Canadian oil pipeline giant Enbridge (NYSE:ENB), which saw an opportunity to pounce and create a North American energy infrastructure superpower by agreeing to acquire the company in an all-stock deal. The combination of Enbridge's 11.5% deal premium, as well as an improving market, enabled Spectra to more than recover from its dismal performance in 2015.

Image source: Getty Images.

Succeeding despite failing

Halliburton had also hoped to take advantage of the oil market downturn to create an oilfield-service giant, which is why it pounced on the opportunity to acquire rival Baker Hughes in late 2014. However, regulators worried that the combined company would become too powerful, which ultimately led to the termination of the transaction this past May. While that denial was a disappointment, Halliburton showed that it could do just fine as a standalone company. During the third quarter, for example, the company generated $1 billion in cash flow from operating activities despite a challenging oilfield-services market. Halliburton believes it can continue to produce healthy cash flow as industry conditions improve, because of its prime position in the U.S. shale market and its significantly lowered cost basis, which gave investors hope that the worst was in the rearview mirror.

Investor takeaway

Heading into the year, most investors feared that 2016 could be a brutal one for energy companies because of persistently weak oil prices. What was surprising is that while commodity prices remained low, energy companies did much better than expected because of their ability to cut costs and capture opportunities to improve their standing. These catalysts fueled remarkable rallies in the energy stocks that the market had pulverized in 2015.