Shares of Canadian National Railway Company (TSX:CNR)(NYSE:CNI) are trading near their 12-month lows, and contrarian investors are wondering if this is a good time to hop on the train.

Let’s take a look at the current situation to see if CN deserves to be in your portfolio.

Diversified business segments

CN provides a service that forms the backbone of the North American economy. As such, the company’s revenue comes from a wide variety of customers and industries, and this diversification across the broader economic spectrum provides a natural cash flow hedge.

In recent years, CN saw strong growth in its energy-related business. The rout in the oil market is slowing that segment down, but the slack is being picked up by automobile and forestry shipments.

When you think about it, this makes sense. As oil prices fall, gasoline costs drop and that provides a nice boost to the auto sector. The plunge in commodity markets has also driven down the value of the Canadian dollar, and that makes Canadian lumber much cheaper for U.S. buyers.

With the U.S. dollar now worth CAD$1.32, CN gets a nice boost when its U.S.-based earnings are converted back into Canadian dollars.

Earnings strength

CN continues to deliver solid results. The company reported Q2 2015 net income of $1.10 per share, up from $1.03 per share in the second quarter of 2014.

The diversified revenue stream is one reason for the strong results. The other side of the equation is cost control.

CN is often cited as North America’s best-run railway. The company’s Q2 2015 operating ratio came in at an impressive 56.4%, down from 59.6% the year before. The number indicates the amount of revenue the company is using to operate the business.

Dividends and share buybacks

CN is very good at returning cash to shareholders. The company increased the dividend by 25% earlier this year and plans to increase its payout ratio to 35%.

That means investors should see more cash headed their way in the coming years.

CN is also an aggressive buyer of its own stock. The company spent more than $400 million on share buybacks in the second quarter.

Should you buy CN?

Investors have enjoyed an average annualized return of 17% over the past 10 years. The company has limited competition and is the only North American rail operator that can offer service to three coasts.

The recent sell-off in the stock is providing investors with an opportunity to pick up the stock at a reasonable 15.5 times forward earnings. As a long-term holding, CN is a great pick.

Here's another oversold top stock!

Does your portfolio have rock-solid blue chips at its core? If it does... GREAT! If not, you might want to reconsider your strategy.

Our analysts have identified one TOP stock for 2015 and beyond--a stock with a tollbooth-like business; a solid management team; and a reliable, consistent, and rising dividend--and today you can download the name, ticker symbol, and price guidance absolutely FREE.

Simply click here now to receive your Special FREE Report, "1 Top Stock for 2015--and Beyond."

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. 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.