OMAHA, Neb. — CSX Corp. said Tuesday that rate increases and a small improvement in the volume of products the railroad hauled helped it deliver 4 percent profit growth even though coal shipments remained down.

The Jacksonville, Fla.- based railroad said it generated $535 million net income, or 52 cents per share, during the quarter on $3.07 billion revenue. That's up from $512 million, or 49 cents per share, on $3.01 billion revenue last year.

The total number of carloads CSX delivered in the second quarter grew 1 percent even though coal shipments were still down 6 percent. Shipments of crude oil, fertilizer and intermodal containers of products drove the volume increase.

The results beat the 47 cents per share profit and $3.02 billion revenue that analysts surveyed by FactSet expected.

CSX shares gained 56 cents to $25.20 in after-hours trading.

"We remain sharply focused on creating strong, sustained value for customers and shareholders, as the economy appears to be slowly gaining strength," said Michael Ward, CSX's chairman, president and CEO.

Railroad officials are still predicting relatively flat earnings growth this year before improvement of 10 to 15 percent a year in 2014 and 2015 as the economy continues to recover.

CSX spent $397 million on fuel in the quarter, down from $410 million, as it improved efficiency and paid 6 cents less per gallon.

CSX has been grappling with significantly lower coal demand for a couple years because relatively cheap natural gas prices and environmental concerns prompted a number of utilities to switch from coal to gas.

But it appears that coal demand is beginning to stabilize. CSX said domestic coal shipments increased in the quarter as natural gas prices rose but coal exports declined, particularly to Europe.

The other areas where shipping volume declined were agricultural products, metals, construction and military equipment and alcoholic beverages.

Investors watch what major freight railroads are carrying closely because railroads are indicators of the nation's economic health.

CSX said train accidents cost it $16 million during the quarter. In May a CSX freight train derailed and a couple of its cars exploded near Baltimore after striking a trash truck. Officials have estimated that high-profile accident caused at least $625,000 damage to the train and tracks as well as to buildings nearby.

CSX operates over 21,000 miles of track in 23 eastern states and two Canadian provinces.

CSX is the first major U.S. freight railroad to release second-quarter earnings. Union Pacific Corp. will release its first-quarter results on Thursday, and Norfolk Southern Corp. will follow next Tuesday.