Shares of railroad transportation company CSX (CSX - Get Report) gained nearly 5% in early trading on Wednesday after the company reported robust first-quarter earnings after the market close on Tuesday, thanks to increases in freight delivery traffic and declining costs.

CSX was up 4.72$, or $3.68, at $79.47 in early trading on the New York Stock Exchange after the Jacksonville, Fla.-based freight company said it earned net income of $834 million, or $1.02 a share, in its first quarter, vs. $695 million, or 78 cents a share, in the comparable year-earlier period.

The results topped Wall Street expectations. The average estimate of analysts surveyed by FactSet was for earnings of 91 cents a share.

Revenue was $3.01 billion in the period, matching analysts' forecasts and "driven by merchandise volume growth and broad-based pricing gains," the company said. Expenses dropped 2% year over year to $1.79 billion, "driven by continued efficiency gains."

The combination yielded operating income growth of 17% for the quarter to $1.22 billion from  $1.04 billion in the same period last year, CSX said.

CSX shares have climbed more than 22% since the beginning of the year. As of Tuesday's close of $75.89, the shares have risen 34% in the past 12 months.