Gettyimages

Image source: Getty Images.

What: Shares of railcar company Greenbrier Companies Inc. (NYSE:GBX) surged 12.7% higher in July after announcing better-than-expected earnings. But the results still showed an overall decline in the business.

So what: Revenue fell 14% in the second quarter of 2016 to $612.9 million and net income fell 17% to $35.4 million, or $1.12 per share. But analysts were only expecting earnings of $1.09 per share, so the results weren't as bad.

A decline in oil shipment demand by rail is a big driver of the slump in demand, but investors anticipated a drop and that's why Greenbrier could beat estimates.

Now what: If the shipping industry doesn't suffer much more, Greenbrier could be a great value for investors going forward. Analysts forecast $5.81 per share in earnings this year, meaning shares trade at just 5.4 times this year's earnings estimate. That's a good value that prices in some downside performance. But with management cutting costs to preserve the bottom line, it could be a more profitable year ahead than many investors were expecting.

Travis Hoium has no position in any stocks mentioned. The Motley Fool recommends Greenbrier Companies. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.