TORONTO (Reuters) - Canadian Pacific Railway Ltd (>> Canadian Pacific Railway Limited) on Thursday reported second-quarter results that were slightly ahead of expectations as the rail operator worked to recover from massive backlogs and an unusually harsh winter.

Canada's second-largest rail operator reported net income of C$371 million ($345.24 million), or C$2.11 a share, up from C$252 million, or C$1.43 a share, a year earlier.

Revenue climbed 12 percent to C$1.68 billion.

On average, analysts had expected earnings of C$2.09 per share and revenue of C$1.65 billion, according to Thomson Reuters I/B/E/S.

Operating income rose by 40 percent, to C$587 million, and operating expenses edged up 2 percent to C$1.09 billion.

CP Rail and larger rival Canadian National Railway (>> Canadian National Railway Company) have come under significant pressure during the first half of the year to clear the backlog from a record grain harvest while dealing with service disruptions caused by the winter weather.

Calgary-based CP Rail said its operating ratio improved by 680 basis points to 65.1 percent during the quarter, despite facing rail congestion around Chicago and other challenges.

Operating ratio is the percentage of revenue needed to maintain operations and is a key measure of railroad efficiency. The lower the number the better.

Chief Executive Officer Hunter Harrison, a rail veteran, has been orchestrating a major turnaround at CP, a former industry laggard, and had promised to squeeze the railway's operating ratio to 65 percent by mid-2016. CP has been ahead of schedule and is now eyeing 63 percent for 2014.

($1 = 1.0746 Canadian dollars)

(Reporting by Solarina Ho, Editing by Franklin Paul and Lisa Von Ahn)