Canadian National Railway Co beat the Street with a 17 percent rise in quarterly profit, reporting higher volumes in most of the products it ships due to a strike at rival CP Rail, and it raised its 2012 profit forecast.

CN, Canada's largest railroad, said it now expects adjusted profit for the year to rise by as much as 15 percent, up from the 10 percent growth it forecast in April.

It also said it expects to generate free cash flow of about C$1 billion ($981 million) for the year, up from its earlier estimate of C$950 million.

Even so, the company's shares dipped 0.5 percent on the Toronto Stock Exchange as analysts said expectations had been high for CN's results and outlook.

"They met a bar that has been raised... The company's guidance basically ended up being in line with what consensus was already at," said BMO Capital Markets analyst Fadi Chamoun.

CN's shares were down 0.5 percent at C$86.85 on the Toronto Stock Exchange late on Wednesday morning. They had been slightly higher earlier in the day.

CP's second-quarter net income rose to C$631 million, or C$1.44 a share, from C$538 million, or C$1.18 a share, a year earlier.

On an adjusted basis, the company earned C$1.50 a share, ahead of the C$1.48 a share that analysts had expected, according to Thomson Reuters I/B/E/S.

"Other than grain and fertilizers, CN registered solid traffic increases in every commodity group during the second quarter," Chief Executive Claude Mongeau said in a statement.

"If economic growth remains on track in the second half, we should deliver another banner year in 2012," he said.

CN said revenue rose 13 percent to C$2.54 billion, due in part to growth in North American and Asian economies and a nine-day strike at competitor Canadian Pacific Railway in the quarter. Revenue was in line with analyst expectations.

In May, about 4,800 locomotive engineers, conductors and traffic controllers went on strike at CP, stalling freight traffic.

Mongeau said that most of the CP customers that CN serviced during the strike returned to CP after the strike ended.

"But it was a great opportunity for us to showcase our service, and we see it as a lead in to a deeper relationship in the future," he said, specifically mentioning Canpotex, the Canadian potash export consortium.

CN is keen to win more business from Canpotex, which primarily uses CP Rail to move its potash.

Earlier on Wednesday, CP, which is Canada's second-biggest railway, reported a 20 percent drop in quarterly earnings due to the impact of the strike.

CN's operating ratio, an important barometer of efficiency in the railroad industry, was flat at 61.3 percent. (Reuters)