Canadian National Railway Company (TSX:CNR)(NYSE:CNI) reported its first-quarter earnings yesterday and, on the surface, things appeared rosy. First-quarter profits of $1.00 a share beat analyst expectations of just $0.93 a share. The profit beat was helped by a 14% decline in operating expenses stemming from lower fuel prices and reduced labour costs.

If results beat expectations, why were shares down as much as 7%?

Mounting headwinds

While its quarterly results were fine, Canadian National Railway lowered its annual profit target for the first time in eight years, citing weak demand for commodities such as coal and oil. It now expects 2016 earnings to experience no growth over last year’s levels, down from an earlier expectation of 4-6% growth. If it reaches its revised $4.44 earnings-per-share target, the stock would trade at 17.5 times 2016 earnings.

Weakness in the commodity market isn’t new. Carloads this year will decline 4-5% as crude oil producers shift output to pipelines and coal companies limit money-losing production. “The volume is weak, will get weaker, and the pricing is not the greatest,” said Chief Marketing Officer Jean-Jacques Ruest, calling crude-by-rail shipments “broadly unattractive.”

Weak volumes aren’t the only concern.

Up until the recent industry downturn, commodity shipping had been one of the railroad’s more profitable lines of business as pricing power is typically much higher.

When the price of oil was over $100 a barrel, oil and gas companies were scrambling to get supply online despite the lack of infrastructure necessary to transport the additional volumes. The explosion of shale drilling just exacerbated this issue.

Oil and gas companies were forced to use rail cars to ship huge volumes of fuel. Almost overnight, crude by rail became one of the biggest drivers of profitability growth for most railroad operators. Now, with farmers, miners, and oil producers all looking to slash costs, margins could collapse in one of the company’s most profitable segments.

“We continue to experience high volatility and weaker conditions in a number of commodity sectors,” CFO Luc Jobin said on the company’s conference call. “We’ve got our work cut out…there are some challenges out there,” added CEO Claude Mongeau.

A difficult future

Right now, shippers like Canadian National Railway are losing market share to pipelines, which can transport energy supplies faster, safer, and much cheaper than by rail. Every day that oil fails to rebound, new pipelines infrastructure is being built to take away any future shipments by railroads.

For example, TransCanada Corporation (TSX:TRP)(NYSE:TRP) has a massive project pipeline worth over $46 billion. Those projects include $20 billion of natural gas pipelines, $25 billion in other liquids pipelines. By 2020, TransCanada expects to grow assets from roughly $60 billion to over $90 billion, comprising 69,000 kilometres of natural gas pipelines and 11,600 kilometres of other liquids pipelines.

It looks like major North American railroads are set to permanently lose a major source of new revenues and profitability. The latest plunge was likely warranted given the difficult future ahead.

Urgent update: Motley Fool issues rare "double down" stock alert

Not to alarm you but you recently missed an important and rare event. Stock Advisor Canada issued a "double down"... and history suggests it pays to listen. Because 10 of the most lucrative "double downs" in one of the Motley Fool's premier services skyrocketed an average of 434%!

So, simply click here to discover why Motley Fool "double downs" have some investors rocking with excitement. Five years from now, you'll wish you'd grabbed this stock.

Click here to learn more.

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 Ryan Vanzo has no position in any stocks mentioned. David Gardner owns shares of Canadian National Railway. The Motley Fool owns shares of Canadian National Railway. Canadian National Railway is a recommendation of Stock Advisor Canada.