If you’d told your friends at the beginning of 2016 that Teck Resources Ltd. (TSX:TCK.B)(NYSE:TCK) would finish the year at $40 per share on the TSX, they would have laughed in your face.

Yet here we are with roughly one month to go, and Teck just broke through the $33 mark.

What’s the story?

Teck entered 2016 in bad shape. A multi-year meltdown in all three of its core products had pummeled prices and squeezed margins to the point where Teck was barely making any money.

Add to this a massive US$9 billion debt load and $1 billion in spending obligations on the Fort Hills oil sands project, and you can see why investors were throwing in the towel on this stock.

As oil plunged below US$26 per share in January, the market figured Fort Hills was a write-off, and Teck’s stock fell below $4 per share.

Today, the world is a very different place.

Metallurgical coal, zinc, and copper prices have staged strong recoveries, boosting Teck’s prospects.

Coal wasn’t supposed to improve in 2016, but a decision by the Chinese government in March to restrict the number of days its mines can operate has had a massive impact on the market.

As a result, supplies have tightened to the point where metallurgical coal prices have surged from US$90 per tonne in July to more than US$300 per tonne today.

The rally caught everyone off guard, and China recently eased up on the restrictions. Coal mines will now be allowed to operate for 330 days in the year instead of previous limit of 276.

This decision should slow down the surge in coal prices, although the price drop that was expected after the November 18 announcement hasn’t happened.

At the time of writing, metallurgical coal spot prices remain above US$300 per tonne.

Effect on Teck

Teck gets most of its coal revenue on fixed quarterly contract rates. The company received about US$90 per tonne in Q3 and is expected to get close to US$200 per tonne in the current quarter.

Negotiations for Q1 2017 will begin soon, and the longer the coal spot price remains at US$300, the more likely it is that buyers will be willing to pay close to that amount.

Could Teck hit $40?

If word starts to get out that buyers are signing Q1 deals above US$250 per tonne, Teck’s stock could get an extra bounce in the coming weeks.

The momentum remains strong, so a surge to $40 shouldn’t be completely ruled out, but there would also have to be a big jump in oil or copper prices to spur a strong extension to the rally.

Should you buy?

The company is a low-cost producer and is enjoying strong margins at current prices. The longer the commodities rally lasts, the higher this stock will go.

Having said that, new investors should be cautious buying at the current price level and might want to wait for a pullback to start a position.

On a personal note, Teck has hit my price target, so I have decided to cash out.

Stock buy alert hits astounding 96% success rate!

The hand-picked investing team inside Stock Advisor Canada recently issued a buy alert for one special type of "bread-and-butter" stock where The Motley Fool U.S. has banked profits on 23 out of 24 recommendations. Frankly, with an astounding 96% success rate that has delivered average returns of 260%, chances are this new pick could deliver life-changing returns as well. Because the team at Stock Advisor Canada fully embraces the same time-tested investing philosophies that have led to countless Motley Fool winners globally. So simply click here to unlock the full details behind this new recommendation and join Stock Advisor Canada.

*96% accuracy includes restaurant stock recommendations from Motley Fool U.S. services Stock Advisor, Rule Breakers, Hidden Gems, Income Investor and Inside Value since each services inception. Returns as of 5/27/16.

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Andrew Walker has no position in any stocks mentioned.