U.S. rail traffic grew by 2.9% in 2017 as strong economic momentum created enough demand for transport to offset weakness in certain commodities. Unsurprisingly, it was a good year for railroad stocks as well, with shares of CSX (NASDAQ:CSX), Norfolk Southern (NYSE:NSC), and Union Pacific (NYSE:UNP) all up between 30% and 50%, and Kansas City Southern (NYSE:KSU) not lagging far behind.

Here's the argument for why 2018 could be even better for the industry.

Trains in the snow

Two Norfolk Southern trains navigate a snowy mountain pass. Image source: Norfolk Southern.

The details

The Association of American Railroads (AAR) said that total carloads grew by 381,266 in 2017, with intermodal traffic reporting its best ever year. Intermodal can be viewed as a measure of how competitive rail is compared to other transport methods, as the containers can easily be transferred to truck if ground is a better option.

The railroads recorded the gains despite slowdowns in coal, grain, and petroleum products. Total carloads were up 2.5% in December, for example, but were up 5.2% if coal and grain are excluded. The explanation for the gains is the economy: Perhaps no sector is more reliant on the overall health of the industrial economy than rail, and with the ISM Manufacturing Index up in 2017, rail was likely to follow.

"Rail traffic is a useful gauge of the state of the economy, and it shows that the economy's momentum strengthened in the fourth quarter of 2017," AAR Senior Vice President John T. Gray said in a statement.

Can it continue?

If rail traffic is tied to economic momentum, 2018 is off to a promising start. Forecasts vary, but the Conference Board, for example, is predicting capital spending to grow at an annualized rate of 6.4% in 2018, up from 4.9% last year, and for overall real GDP to grow by 2.9%.

Tax relief, regardless of its long-term implications for the economy, figures to be a stimulus in the near term. In addition to lower rates, businesses are allowed to immediately deduct investment spending from corporate tax payments for the next five years. That is likely to push forward purchases of heavy equipment typically shipped by rail, adding to demand. Any progress on an infrastructure funding package discussed on Capitol Hill could further stimulate demand.

A slow creep higher in oil prices should also benefit rail, making railroads more competitive against trucking. Crude prices have been gaining steadily since mid-2017, with Brent crude on Jan. 11 hitting $70 a barrel for the first time since December 2014. The strong economy has also led to a shortage in truck drivers, which is likely to raise costs for truckers and help rail competitiveness.

Tax splurge

Even without growing demand, there are reasons to like railroads in 2018. The companies will benefit from the new 21% corporate rate, with Union Pacific, Norfolk Southern, and CSX paying median effective tax rates of 37.5%, 36.2%, and 36.7%, respectively, according to FactSet data. By comparison, the average for industrials was a 30.8% median rate and 30% for the S&P 500.

Citi analysts earlier this month upgraded the rails, saying the Tax Cut and Jobs Act drives a "meaningful step up" in earnings power and free cash flow, and saying U.S. railroads could boost dividends by 15% to 20%. That's to be seen, but if nothing, else railroads should have ample cash to return to shareholders.

Climb aboard?

The picture isn't completely rosy for the rails, as there are some company-specific concerns. CSX, for example, has an industry-high 30.15 price-to-earnings ratio based on anticipation that the company's early-stage, and highly complex, turnaround will prove to be a success. That's no guarantee. Kansas City Southern, meanwhile, would be hit harder than most if the U.S. follows through on threats from NAFTA. Investors should weigh those two situations very carefully before buying in for macro reasons.

But for Union Pacific, as well as for Norfolk Southern and Canadian giants Canadian Pacific and Canadian National, all of the trends are pointing in the right direction. It's a good time to be working on the railroads.

Lou Whiteman has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Canadian National Railway. The Motley Fool has a disclosure policy.