When Canadian National Railway (NYSE:CNI) reported its first-quarter results on April 24, they were more of the same excellent results investors have gotten used to, and even better than we've seen in recent years. The company reported revenue of 3.2 billion Canadian dollars, up 8%, and earnings per share of CA$1.16, up 16%.

CN, as it is commonly known, saw carloadings increase 9% with growth coming from all but two of its customer segments, and rail ton-miles increase 14%. However, higher fuel costs -- up 46% from last year -- and tariffs on a major Canadian export -- wood products -- are set to impact the company's results for the rest of the year.

Canadian National train with snow-capped mountains in the distance

Image source: Canadian National Railway.

Keep reading for a closer look at CN's results, as well as what management has to say about fuel, wood products, and the company's prospects.

Note: All financial amounts in this article are in Canadian dollars, as reported by Canadian National Railways.

Strong growth across product segments driving solid results

One of CN's competitive advantages is that it's one of the most diversified major railroads. In the first quarter, five different kinds of carloadings each accounted for more than 10% of its total revenue, with intermodal -- which is actually made up of lots of different kinds of freight -- being the biggest at 23%. Better yet, the company saw carloads increase in four of those five, and rail ton-miles increase in every carloading category except forest products.

Transmodal shipping containers at port in Vancouver

Image source: Canadian National.

Not only does this diversity of revenue streams help offset cyclical weakness from a single industry, but it also gives CN flexibility in where it can invest for future growth. CN's recent investments in expanding its intermodal capacity are paying off, with carloads up 9% and rail ton-miles up 8% last quarter. The company also benefited from management's efforts to strategically position its operations for the recent surge in grain-shipping demand, following bumper crops in Canada's grain belt. Carloads were up 12% and rail ton-miles increased a whopping 24% in this category, which was 19% of revenue in the quarter.

Tariffs and oil prices are set to create profit headwinds

Over the past couple of years, shipments of Canadian lumber and other forest products have been a source of solid revenue and growth for CN. And with U.S. new home construction set to continue growing in a solid economy with strong demand, this is an industry CN has been counting on to be a source of stable growth in the near future.

Wooden frame of a new home under construction

Image source: Getty Images.

However, recent trade actions by the Trump administration could put the brakes on that, at least for the short term. In late April the U.S. Department of Commerce put tariffs of between 3% and 24% on different Canadian wood-products companies, a move that's almost certainly going to impact volumes that cross into the U.S. A final ruling isn't expected until September, and in the interim, it's likely that American lumber buyers will look for alternatives, as these tariffs will essentially get passed along to the buyer.

At the same time, oil prices are up sharply since last year, which means CN's cost for diesel is up as well. Last quarter, the company spent CA$342 million in fuel, 46% more than the year-ago quarter. The higher fuel price was the primary reason that CN's operating ratio -- the percentage of revenue that covers operating expenses -- increased 50 basis points to 59.4%. Management says that higher fuel prices will increase the operating ratio by 50 to 100 basis points for the full year.

Even with challenges, management sees a big year ahead

Higher fuel prices have been an eventuality for some time, and to some extent CN is able to pass this along to customers. And even with the potential weakness in forest products, depending on how things play out with the proposed tariffs, CN's management expects rail ton-miles to increase 10%, and pricing to increase higher than inflation, with strong demand across multiple carload types.

Based on these expectations, management increased its guidance for earnings as well, boosting adjusted earnings per share from the prior guidance of CA$4.59 to a range of CA$4.95 to CA$5.10 -- an 8% to 10% boost in guidance and a 6% to 9% increase from 2016.

While CN will still feel the impact of economic swings and industry cycles, it remains one of the best-run, most efficient railroads in North America. Management's steady focus on allocating capital across multiple carload types and diversifying the company's operations continues to pay off for long-term investors. It looks like management is set to continue delivering solid returns in the years ahead.

Jason Hall has no position in any stocks mentioned. The Motley Fool owns shares of and recommends Canadian National Railway. The Motley Fool has a disclosure policy.