By Allison Lampert

(Reuters) - Canadian Pacific Railway Ltd <CP.TO> <CP.N>, Canada's No. 2 railroad operator, said on Wednesday its chief executive would leave five months earlier than originally expected and it reported a lower-than-expected adjusted quarterly profit.

Hunter Harrison will officially step down on Jan. 31 and be replaced by Chief Operating Officer Keith Creel.

Last April, a company spokesman said Harrison planned to serve out his contract ending in June 2017.

A source familiar with the matter said Harrison and former Pershing Square Capital partner Paul Hilal were in the final stages of working out an agreement for an activist stake in U.S. railroad CSX Corp. <CSX.O>

A spokesman for CSX declined to comment on market speculation.

CP declined on Wednesday to give details on Harrison's retirement plans or the terms of a separation agreement reached with the railroad veteran.

According to a CP statement, Harrison asked CP's board for an arrangement "that would allow him to pursue opportunities involving other Class 1 Railroads."

Harrison also got a "limited waiver" of his non-compete obligations and forfeited C$118 million in benefits, CP said.

On a call with analysts, Creel said CP expected slightly positive volume growth in 2017, fueled by increased deliveries in potash and grain, despite weak crude shipments acting as a headwind during the first quarter and in 2016.

"As we go into 2017 and 2018, you'll see top-line growth, you're going to see bottom-line control," Creel told analysts on a conference call.

The Calgary-based company reported a 20.4 percent jump in net income to C$384 million ($290 million), or C$2.61 a share, in the fourth quarter ended Dec. 31, from C$319 million, or C$2.08 per share, a year earlier.

Excluding certain items, the company earned C$3.04 a share, missing the average analyst estimate of C$3.11, according to Thomson Reuters I/B/E/S.

The company said its operating ratio, a key metric, dropped to 56.2 percent in the fourth quarter from 59.8 percent a year earlier.

The lower the ratio, which measures operating costs as a percentage of revenue, the more efficient the railroad.

CP also said it planned to invest about C$1.25 billion in capital programs in 2017, an increase of 6 percent from the C$1.18 billion spent in 2016.

Revenue fell about 3 percent to C$1.6 billion. Analysts on average had expected C$1.65 billion.

($1 = C$1.33)

(Reporting by Allison Lampert in Montreal; Additional reporting by Gayathree Ganesan and Ahmed Farhatha in Bengaluru and Michael Flaherty in New York; Editing by Chris Reese and Peter Cooney)