Canadian Pacific Railway Ltd posted a 30 percent jump in quarterly profit, beating analyst expectations on the back of higher volumes and cost controls.

CP, Canada's second-biggest railroad, earned C$166.6 million ($162 million), or 98 Canadian cents a diluted share, in its second quarter ended June 30. That compared with C$135.5 million, or 80 Canadian cents a diluted share, in the year-earlier period.

Adjusted to exclude foreign exchange gains and losses on long-term debt and other specified items, CP said it earned 92 Canadian cents a share.

Revenue at the railway, which has operations in Canada and the northern United States, rose 20 percent to C$1.23 billion.

Industry analysts, on average, had expected earnings of 83 Canadian cents an adjusted share, according to Thomson Reuters I/B/E/S. The average revenue forecast was C$1.23 billion.

CP warned last month its second-quarter earnings could be reduced by between 10 and 13 Canadian cents a share because of an 11-day closure in June of its main transcontinental line due to flooding in Alberta and Saskatchewan.

"Frankly, I'm just shocked," said Steven Hansen, an analyst at Raymond James in Vancouver. "They came out with that prerelease saying that the flood would cost the 10 to 13 cents and I think a lot of guys just went out and slashed their numbers on that release alone, but the issue was that the volumes were already well above most people's expectations."

Revenue rose in nearly all freight categories with the exception of grains, which were hit by flooding, said Hansen.

"It was just really cost-containment on a few line items, most notably on materials from our perspective, that really accounted for the big variance," he said.

CP said at the time that it expected the majority of the shipments that were backed up due to the flooding to move in the third quarter.

Fred Green, chief executive of the Calgary-based railroad, said in a release that the company was well-positioned for the second half of the year, but that markets "are likely to remain volatile."

CP's management has been one of the more cautious railroad management teams through the recovery, said Hansen. "Of late they have probably been a bit too cautious."

"Railroads are one of the true barometers of the broader economic activity in North America and by most accounts, railroad volumes continue to be strong," he said.

Growth numbers are not going to be as high going forward, because of difficult comparisons to the year-ago quarters.

"You've got to remember that Q2 last year was pretty much the trough of carload volumes and so it's no surprise that growth numbers are big. ... We continue to expect some modest uptick, but not a great uptick, so you should see growth just on that virtue alone, but you won't be seeing the eye-popping numbers."

Canadian National Railway , the country's biggest railroad, reported a 38 percent jump in quarterly profit last week and raised its full-year forecast to a 25 percent earnings increase on expectations the economy will continue its rebound. (Reuters)