Canada's major railways are weathering the slump in freight traffic that has gripped the North American rail sector, aided by a slumping loonie and a tight rein on costs.

Canadian National Railway Co. on Tuesday beat analysts' expectations with an 11-per-cent rise in fourth-quarter profit and raised its dividend by 20 per cent.

Calgary-based Canadian Pacific Railway Ltd. last week posted record profit for the final three months of 2015, even as freight volumes slowed across a broad range of goods.

Story continues below advertisement

Montreal-based CN said profit rose to $941-million while diluted earnings per share increased by 15 per cent to $1.18. Revenue fell by 1 per cent to $3.2-billion as carloads declined by 8 per cent.

Analysts had expected per-share profit of $1.11 and revenue of $3.2-billion.

"Execution in a challenging market continues to be a strength of CN," said Christian Wetherbee, an equities analyst with Citigroup.

"I'm proud of the team and what they were able to achieve," CN chief executive Claude Mongeau said, on his first conference call since taking time off in August for surgery on a throat tumour.

Story continues below advertisement

"The team did such a good job I couldn't wait to come back," he said, making light of his treatment. "I have a new voice; it is a bit squeaky," Mr. Mongeau said.

Both railways get more than half of their revenues in U.S. dollars, while many of their expenses are in Canadian currency. CN said the weakness in the Canadian currency against the U.S. dollar boosted revenue by 9 per cent or $87-million for the quarter.

For the full year of 2015, CN's profit rose by 12 per cent to $3.5-billion, or $4.39 a share. Revenue rose by 4 per cent to a record $12.6-billion.

CN has a work force of 23,000 – 9-per-cent fewer employees than a year ago – and a 20,000-mile network in Canada and the United States that reaches three coasts.

Story continues below advertisement

CN's quarterly operating ratio, a closely watched measure of costs versus revenue, improved to 57.2 per cent, compared with the industry median of 63.4 (lower is better). CP's operating ratio, meanwhile, is 59.8 per cent, a vast improvement over the past four years.

Mr. Mongeau acknowledged his rival's success, and said the efficiencies of both companies are "something to be proud of here. We have two Canadian railroads leading in terms of performance."

Railway freight volumes have slumped in the past year as demand and prices for industrial commodities slowed. The decline, blamed in part on China, has helped send railway share prices lower. CN's share price on the Toronto Stock Exchange has fallen by about 17 per cent in the past 12 months, matching the decline on the broad S&P/TSX composite index. The U.S. Dow Transportation Average of 20 stocks has declined by 25 per cent over the same period.

Mr. Wetherbee, the analyst, said CN shares trade at a premium to its peers, and he remains neutral on them.

Story continues below advertisement

In the fourth quarter, CN posted higher revenue for automotive, forest products, intermodal containers and grain. Sales fell for metals and minerals, coal, and petroleum and chemicals.

For 2016, CN is forecasting "mid-single-digit" growth over 2015's per-share earnings of $4.44 as the company increases prices by 3 per cent more than inflation. Capital investments are expected to be $2.9-billion.