Amid weak commodity markets and a shaky domestic economy that have hammered freight volumes, Canada’s largest railway is counting on the resilient U.S. economy to help it post double-digit earnings growth.

Luc Jobin, chief financial officer of Canadian National Railway Co., said forestry carloads for the U.S. housing industry and automotive shipments are helping offset poor demand for coal, grain and oil.

Intermodal container shipments, made up largely of consumer goods, have been the strongest segment for both major Canadian railways this year, rising 6 per cent while growth in overall shipment is flat, the Association of American Railroads said on Wednesday.

“The good news is the U.S. consumer … is actually faring pretty well, so our forest products business has been growing nicely with U.S. housing starts,” Mr. Jobin told an investors’ conference in Boston on Wednesday. “ I actually do believe when you compare it to most places in the world, most people would love to be catering to the U.S. economy.”

Domestic and U.S. freight volumes for CN andCanadian Pacific Railway Ltd. are nearly unchanged this year from last.

Mr. Jobin expects the Canadian economy will lag that of the U.S. in the second half of 2015, but sees no “significant” recession as a low dollar helps exporters and offers Canadian oil producers a hedge against low crude prices.

Coal shipments have fallen 12 per cent as power plants switched to cheaper natural gas and steel makers geared back . Grain shipments are down 13 per cent compared with last year, when the grain companies were still moving the massive Canadian crop of 2013-14.

But it was the plunge in oil prices by 50 per cent and the subsequent drop in shipments by rail that caught CN by surprise, Mr. Jobin said.

CN, which responded by idling 200 locomotives and laying off 600 employees, sees oil shipments “stabilizing” in the second half of 2015.

Carloads of oil and other energy shipments rose 7 per cent in the second week of September, from a year earlier, and are up almost 3 per cent this year for CN and CP, industry figures show.

In the second quarter, CN said revenue measured per ton-mile fell 7 per cent, but it was able to raise prices almost 4 per cent and stuck with its forecast of a double-digit boost to 2014’s adjusted earnings per share of $3.76.

CP’s chief operating officer Keith Creel told a Montreal investors conference that the Canadian grain crop would be bigger than expected, but declined to offer any outlook for 2016.