Revenue improved 7 percent to $5.63 billion as the railroad increased rates 3.5 percent and volume grew 2 percent overall.
Edward Jones analyst Logan Purk said the results show that Union Pacific has more pricing power than other railroads because it has more long-term contracts coming up for renewal.
Analysts surveyed by FactSet expected Union Pacific Corp. to report more modest quarterly earnings per share of $2.49 per share on revenue of $5.57 billion.
Company shares rose $5.56 to $174.15 on the beat.
CEO Jack Koraleski said Thursday that it looks like the economy will continue to strengthen slowly this year, and the railroad is ready to handle the growth.
Agricultural shipments grew 13 percent thanks to the strong grain harvest. The railroad also delivered 10 percent more automotive shipments. Union Pacific also hauled 9 percent more shipments of industrial products.
Weak coal demand has been a challenge for all the major freight railroads, with so many power suppliers switching to cheap natural gas.
Even with the decline in coal shipments, Union Pacific said coal revenue declined only 1 percent to $985 million because of rate increases.
The railroad repurchased more than 4.9 million shares during the quarter for $786 million reducing the number of shares outstanding by about 2 percent.
Union Pacific operates 32,400 miles of track in 23 states from the Midwest to the West and Gulf coasts.