Shares of Union Pacific (NYSE:UNP) hit a 52-week high on Friday. Let's take a look at how it got there and see if clear skies are still in the forecast for this railroad operator.

What could derail Union Pacific
For much of the past year, the railroad sector has been struggling with a rapid decline in coal prices and demand due to warmer weather and a sharp drop in natural gas prices, which caused many electric utilities to convert their coal-fired plants into natural gas-burning electrical facilities. Union Pacific and Berkshire Hathaway (NYSE:BRK.A) (NYSE:BRK.B)-owned Burlington Northern Santa Fe are the two primary coal transporters out of the Powder River Basin, the main coal-producing hub on the West Coast, and both have seen coal demand and coal revenue shrink.

The effect has been even more pronounced for East Coast rail operators CSX (NASDAQ:CSX), the nation's largest hauler of coal by volume, and Norfolk Southern (NYSE:NSC). CSX recorded a 26% drop in year-over-year coal volume in the third quarter while Norfolk Southern reported a 22% drop in coal revenue in its most recent quarter. 

Large natural gas deposits in North America threaten to keep natural gas prices low over the long term, encouraging further investment by electric utilities in natural gas-powered facilities. Furthermore, the Obama administration has made it clear that while coal remains a vital part of America's plan for energy independence, he'll be encouraging investments in alternative forms of energy.

One final factor that will affect any of these railroad companies is the state of the U.S. economy. Constraints in consumer and business spending could threaten to reduce shipments on everything from chemicals and automobiles to agricultural products.

Why it's at a new high
It hasn't been an easy road, but Union Pacific's 52-week high appears well justified following the company's best-ever quarterly results in October.

One of the keys to pushing Union Pacific higher has been its well-diversified operations, which led to an industry-best operating ratio of 66.6%. A mixture of flat year-over-year diesel fuel pricing and a double-digit boost in chemical and automotive sales, boosted by a rebound in the housing sector and a rejuvenated auto sector, led Union Pacific to report a 5% increase in total revenue despite a 12% decline in coal volume.  

Another trend working in its favor that worked against it earlier in the year is a steady rise in natural gas prices. This isn't to say that natural gas prices are "expensive," but relative to where they were previously, coal has become a more attractive fuel source, buoying coal prices and enticing a slight pick-up in demand.

Can Union Pacific head higher?
If you haven't figured it out by now, one factor that's crucial to pushing Union Pacific higher is coal demand. If coal prices keep creeping higher and domestic coal companies turn to China and other overseas markets that are extremely coal dependent, then, yes, Union Pacific could head even higher.

Domestically, Arch Coal (NYSE: ACI) has signed multiple export agreements out of the West and in the Gulf of Mexico in a bid to quadruple its coal volume exports by 2020. Similarly, CONSOL Energy (NYSE:CNX) CEO Brett Harvey told analysts in a conference call back in 2011 that his company would target exporting up to 15 million tons of coal by 2015 (representing about a 50% increase from 2011 levels).

As long as domestic companies keep looking overseas for demand and consumer spending keeps trudging forward, there's little reason why Union Pacific won't maintain its best-in-class operating ratio and head even higher. As such, I'll be keeping my CAPScall of outperform on the company.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.