Military shipbuilder Huntington Ingalls (HII -0.29%) did not have a great 2017  -- and its Q4 was even worse.

You may be surprised to hear that, given how strongly Huntington Ingalls stock has performed over the past couple of weeks. Up 6% in the first hours following earnings on Feb. 15, the stock has gone from strength to strength and closed out last week up 10% from its pre-earnings price.

Yet look at the numbers. Revenue in Q4 grew 4% year over year. Per-share profit, however, plunged 66% to $1.21 per share in Q4, hurt by a big batch of one-time charges to earnings: higher tax expenses tied to pension contributions, other expenses for early debt repayment, and -- you guessed it -- expenses tied to tax reform, too.

Upward pointing arrow climbing a bar chart next to number 2018

2018 looks to be a very good year for Huntington Ingalls stock -- but what comes next? Image source: Getty Images.

What's more, Q4's results represented a slowdown from growth earlier in the year. For 2017 as a whole, sales grew more than 5% to $7.4 billion, and profits, although down year over year, fell only 14%. (Excluding one-time items, pro forma profit was flat at $12.14 for the year). Free cash flow, too, declined for the year, falling 16% from 2016 levels to just $453 million.

Yet despite all this bad news, Huntington Ingalls stock is up -- and not by a little. So what happened here? Were investors just feeling in a forgiving mood last week, or is there something else going on at Huntington to explain investors' optimism?

The easy answer

The easy answer is that investors may have liked Huntington Ingalls' numbers because, although they were bad, they were at least less bad than analysts had told  investors to expect. Pro forma (i.e., not counting all the one-time charges), Huntington earned $3.11 per share in Q4, and that surpassed analyst estimates by $0.17 per share. The $2 billion in revenue that Huntington brought in during the quarter likewise exceeded expectations for only $1.94 billion.

But Huntington did more than just beat earnings. It also dropped a series of hints that suggest things could quickly get better for the company.

Book-to-bill-to-sales growth

In 2017, Huntington Ingalls booked $8.1 billion in new contract awards -- 9% more than it billed as revenue -- hence, a book-to-bill ratio of 1.1. When orders come in faster than they can be executed, that's a recipe for future sales growth. Analysts at Wall Street banks are expecting Huntington's sales to grow only 1% this year, and only 3% more in 2019. The company's strong order book, however, suggests Huntington might exceed those expectations and beat earnings yet again.

Lending support to that belief, Huntington noted in its report that, thanks in part to all the new business it won in 2017, its backlog of contracts won but not yet fulfilled has grown to $21.4 billion -- nearly three years' worth of work. What's more, less than a week after Huntington said that, its backlog grew by a further $1.4 billion when the U.S. Navy awarded Huntington a $1.43 billion contract to build a 13th San Antonio-class amphibious warfare ship, landing platform dock 29 (LPD 29). Added to an already strong order book, these new revenues promise even more growth in the future.

Valuing Huntington Ingalls

What's more, with so many charges to earnings already in the rearview mirror, Huntington Ingalls looks likely to post even stronger growth in profits than it will enjoy in sales. Analysts quoted on S&P Global Market Intelligence predict that Huntington Ingalls will earn $17.49 per share this year -- trading Q4 2017's 66% decline in profits for a 67% increase in profits in 2018. If that's how things work out, then even after its recent share price strength, Huntington Ingalls stock sells for an apparently unchallenging 15.2 times forward earnings.

Does that make Huntington Ingalls stock a buy? Investors last week voted yes. But I admit I still have some doubts. For one thing, after Huntington has surged in 2018, analysts expect earnings to grow by only a meager 5% over the next two years -- and then begin declining as early as 2021. In fact, by 2022, analysts predict Huntington Ingalls will be earning less profit than it's expected to earn this year.

Long story short, investors are buying Huntington Ingalls now in anticipation of a very good 2018. Even if that buy thesis works out, though, future years look like they could be less kind to Huntington Ingalls shareholders. If you ask me, right after Huntington Ingalls stock has notched a 10% gain, it might be a fine time to begin heading for the exits.