The entire railroad industry went on a tear in 2014, but no company did better than Union Pacific (NYSE:UNP). Racking up a more than 40% stock gain last year, North America's largest publicly traded railroad nearly doubled the industry average return and quadrupled the return of the S&P 500. What was behind Union Pacific's stellar year? More importantly, can it do it again?

Railroads have actually been crushing market returns for 25 years, following a period of reorganization and consolidation following the industry's deregulation in 1980. In particular, railroads have been resurgent since the 2009 recession, with increased trade spurring demand for rail as a fuel-efficient, low-cost transportation alternative. Perhaps surprisingly, railroads have increased revenue faster than total carloads, adapting to economic conditions and showing themselves to be surprisingly agile despite their staid reputation.

Source: Union Pacific.

On the right track
At Union Pacific, while carloads have risen over 15% since 2009, freight revenue has jumped over 60%, reflecting the company's pricing discipline and its pivot toward a more profitable product mix. The secular decline of coal, once the railroads' bread and butter, has forced Union Pacific to seek growth in other categories. Since coal has the second-lowest average revenue per car, behind only intermodal shipments, Union Pacific's "diverse franchise" strategy has resulted in revenue growth consistently outpacing volume growth.

One of Union Pacific's biggest success stories, both in 2014 and over the past several years, has been in converting intermodal containers from trucks to trains. Systematic reinvestment in its network, including converting trackage to allow for double-stacked containers, improving intermodal interchange facilities, and offering door-to-door transportation services, has allowed Union Pacific to steadily gain market share in intermodal cargo. I expect intermodal brought in nearly $4.5 billion for Union Pacific in 2014, up from $4 billion in 2013 and just $2.5 billion in 2009.

In 2014, Union Pacific also rode the wave of a record crop in North America, spurring gains in both feed and ethanol. As agricultural goods are the highest-value category in Union Pacific's business, this increase in volume produced outsize returns in revenue, potentially up over 20%. 

Finally, Union Pacific has also seen strength in chemical and industrial products shipments stemming from the fracking boom in the United States. Shale fields ship in industrial products such as drilling equipment and specialized sand used in the fracking process, and ship out crude oil. Industrywide, crude-by-rail shipments have grown from a 9,500 carload business in 2008 to an expected 500,000 or more in 2014. For Union Pacific, frack sand shipments were up 39% in the third quarter, leading industrial products to a 19% gain.

Full steam ahead?
So can Union Pacific stock beat again this year? We can count on the company continuing to invest in its track and its capabilities to deliver ever higher profitability, but Union Pacific's freight segments are more of a mixed bag. The intermodal business should remain strong, with the inherent cost efficiency of rail over highway allowing Union Pacific to further grow its franchise.

In agriculture, the bumper crop of 2014 has led to low grain prices, leading the U.S. Agriculture Department to predict a modest decline in cultivated acres next season. It should be noted, however, that after a record crop in 2013 many expected modest declines in 2014 as well, with the USDA increasing its estimates during the year due to excellent growing conditions.

If grain shipments do decline, automotive shipments might pick up the slack. This year looks set to continue the trend of near-record sales U.S. automakers reported in December. With the average car on the road over 11 years old, relatively low interest rates and shockingly low fuel costs should encourage more vehicle purchases.

Those low fuel costs are a double-edged sword for Union Pacific. Since fuel is such a significant expense for railroads, a lower diesel price will boost profitability in the short term. However, as my college Dan Caplinger rightly pointed out, a falling oil price also hurts the shale fracking operations that have been such a boon to Union Pacific. Prolonged cheap oil could eventually force shale oil producers to shut up shop.

While caution is merited, I don't see that as a reason to avoid the stock. Thanks to Union Pacific's diverse franchise, any hit to fracking-related shipments is likely to be washed out by increases in intermodal and automotive shipments. Union Pacific does not rely on any single business area, and apart from a global downturn, weakness in one area is likely to be offset by strength elsewhere. Union Pacific certainly faces more headwinds in 2015 than it did in 2014, but I continue to see this stock as a safe, solid investment that will outperform the market over the long term.