CONSOL Energy (CNX -0.63%) has been providing America with energy since the civil war. Primarily a coal producer throughout its history, the company has shifted its focus toward cleaner burning natural gas in recent years to take advantage of its abundance and appease growing climate change concerns. That said, gas has become so abundant over the past few years, that it caused its price and the price of coal to collapse, which would weigh heavily on CONSOL's stock price.

However, improving market fundamentals last year drove the price of both energy commodities up. As a result, CONSOL's stock price more than doubled.

CNX Chart

CNX data by YCharts

That remarkable run last year might continue because CONSOL has an attractive catalyst on the horizon.

What went right in 2016?

CONSOL Energy is in the midst of a major transformation. The legacy coal company has shifted its investment focus away from coal and toward natural gas. That was clear from the onset of last year when it released its capital expenditures budget. The company planned to spend up to $325 million in its exploration and production division, which would boost its gas output by 15%. Meanwhile, it only expected to spend up to $190 million in its coal division, which would be just enough capital to maintain its output.

The company would continue to shift away from coal during the year by completing a series of strategic transactions. The company sold several coal assets last year, including its Buchanan Mine in Virginia for $420 million and an additional 5% interest in the Pennsylvania Mining Complex to CNX Coal Resources (CCR) for $88.8 million. As a result, the company has now sold more than $5 billion in coal assets since 2012. Meanwhile, the company would go on to strengthen its gas business by separating from its 50-50 joint venture with Noble Energy (NBL). That transaction would give CONSOL and Noble Energy 100% control over two different operating areas, enhancing their development flexibility. In CONSOL's case, it now has more control over its growth as it transitions into a pure-play gas producer.

Aside from that transition, the other important driver of CONSOL Energy's stock was a rebound in coal and gas prices. Natural gas rallied for several reasons. First, domestic production declined last year for the first time in more than a decade. Meanwhile, gas overtook coal as America's leading fuel for electricity generation, rising to 34% last year while coal slid to 30%. Finally, America became a net exporter of natural gas thanks to increasing demand from Mexico and the opening of a new LNG export facility along the Gulf Coast. That rise in the price of gas, as well as the election of a pro-coal President, drove up coal prices last year.

Coal in the hands of a miner.

Image source: Getty Images.

2017: Ending an era at the right moment

While CONSOL Energy rode the wave of higher commodity prices last year, it might not have the same wind at its back this year. That is because the natural gas market faces some potentially stiff headwinds this year, which could keep a lid on its price. Supplies, for example, are expected to pick up in 2017 according to the U.S. Energy Information Administration (EIA), which sees gas production in the U.S. increasing by 1.3 Bcf/d to 73.7 Bcf/d. Meanwhile, the EIA sees higher gas prices this year causing natural gas' share of the electricity generation market to fall to 32% while coal's share should rise to 31%. At the same time, the EIA projects that total U.S. electric generation will fall by 0.1% this year, giving gas a smaller share of a shrinking pie.

That said, those projections are more bullish for the coal market, which has its brightest outlook in years. That is evident by the comments of Joseph Craft, the CEO of coal producing MLP Alliance Resource Partners (ARLP -0.33%) and its general partner Alliance Holdings GP (NASDAQ: AHGP). In Alliance Resource Partners' fourth-quarter earnings release last month, Craft said, "Entering 2017, supply demand fundamentals continue to point to a cyclical recovery in the U.S. thermal coal market." The Alliance Holding GP CEO would go on to note that coal supplies came down sharply last year, which significantly reduced the industry's stockpiles. Because of that, the company planned to increase production this year to take advantage of higher prices and an improving regulatory environment as a result of President Donald Trump's election.

That improving market environment could play right into CONSOL Energy's hands because its primary focus in 2017 will be to completely separate from its coal business by the end of this year. The company intends to explore a variety of options, including a sale of the coal business or a spin-off to shareholders, including plans to evaluate further drop-downs to its MLP CNX Coal Resources. Given the improving coal market, CONSOL's timing could not be better because it should be able to capture a higher value for its coal assets. In fact, a sale of the coal business at an excellent value to a company like Alliance Resources Partners could ignite another big rally in CONSOL's stock this year.

Investor takeaway

Rising gas and coal prices fueled an impressive run in CONSOL Energy's stock last year. While the gas market faces some headwinds this year thanks to rebounding supplies, the coal market appears to have room to run. That could allow CONSOL Energy to unload the rest of its coal assets for an attractive value, which is a catalyst that could enable the stock to continue running higher in 2017.