(Recasts; adds analyst comment, estimates)
TORONTO, April 20 (Reuters) - Canadian National Railway Co posted higher first-quarter earnings on Monday, topping analysts' expectations, and said it would boost capital spending to improve safety as volume rises.
Freight volume also rose in the quarter, with carloads up 9 percent as shipments in every major commodity category but coal rose from a year earlier. Earnings per share rose 30 percent on an adjusted basis, coming in slightly ahead of expectations.
Net income rose to C$704 million, or 86 Canadian cents a share, from C$623 million, or 75 Canadian cents, a year earlier. Excluding a gain on the sale of a rail line, earnings in the previous year had been 66 Canadian cents a share. Revenue also rose to C$3.10 billion from C$2.69 billion.
Analysts, on average, had expected earnings of 85 Canadian cents a share on revenue of C$3.06 billion, according to Thomson Reuters I/B/E/S.
Morningstar analyst Keith Schoonmaker said profit margins were outstanding given the sharp increase in volume since in the short term, higher volumes tend to weigh on railway margins.
"You can take out capacity very quickly, but it's normally difficult to handle a sudden influx of demand," he said.
Canada's biggest railway raised its planned capital spending for 2015 to C$2.7 billion from a previous forecast of C$2.6 billion, saying it would spend an extra C$100 million to improve track safety as volumes increase.
The railway has suffered a string of derailments recently, and last month a Reuters investigation found that its safety record had deteriorated sharply in 2014, reversing years of improvements as accidents blamed on poor track conditions jumped.
CN said it expects shipments of crude oil and frac sand to rise by 40,000 carloads in 2015. It had previously forecast a 75,000-carload increase. In 2014, it shipped 128,000 carloads of crude and 89,000 carloads of frac sand, which is used in hydraulic fracturing.
"I think most expected that number to come down," said Edward Jones analyst Jeff Nelson on the revised forecast. "That seems a little bit worse than what we were thinking."
CN's operating ratio, a key efficiency measure, improved to 65.7 percent from 69.6 percent. The operating ratio measures operating costs as a percentage of revenue, so lower figures indicate improved performance.
Canadian Pacific Railway Ltd, CN Rail's rival, is set to report quarterly earnings on Tuesday morning. (Reporting by Allison Martell; editing by Chris Reese, G Crosse and Meredith Mazzilli)