Lockheed Martin (LMT -0.27%) stock popped 2% on Monday after reporting fiscal Q4 and full-year 2017 earnings. Lockheed stock gave back only a small fraction of a percent of that gain on Tuesday, a day when the Dow Jones Industrial Average sank nearly 1.4%

Clearly, Lockheed Martin did something right last quarter, but what? Let's find out.

F-35 fighter jet seen head-on

Lockheed Martin stock looked positively photogenic in its Q4 close-up this week. Image source: Getty Images.

First, the bad news

At first glance, it's hard to see what all the fuss is about. Lockheed's earnings in fiscal Q4 2017 ... well, there weren't any earnings. Thanks to a $1.9 billion "one-time charge related to tax reform," Lockheed actually reported a $2.25-per-share net loss for the quarter. That being said, if tax reform hadn't happened, Lockheed would have done well in Q4. Really well.

And now the good news

Lockheed booked $15.1 billion in sales in Q4, up 9% from Q4 2016. Sales for 2017 as a whole grew 8% to $51 billion.

Adjusted earnings from continuing operations -- excluding the tax charge -- surged to $4.30 per share in Q4, and $13.33 for the year as a whole. And because "substantially all" of the tax charge was non-cash, it didn't prevent Lockheed from generating $1.5 billion in operating cash flow in Q4 (double what it produced in Q4 2016), and $6.5 billion for the year (up 25% year over year).

Lockheed Martin CEO Marillyn Hewson called these results "outstanding," and it's hard to disagree.

More good news

Believe it or not, we haven't yet reached the best part. Thanks both to an accounting change and to an expected lower tax rate from tax reform (the flip side of Q4 2017's tax-related charge to earnings), Lockheed Martin has drastically raised guidance for what it expects to sell, and earn, in 2018.

Sales guidance for this year has been raised to about $50.75 billion, basically flat against 2017 sales. But Lockheed is looking to book about a 13.5% operating profit margin on its sales, and to report net earnings of about $15.35 per diluted share. That's not just more than twice Lockheed's tax-reform-depressed earnings of 2017. It's about 15% better than the adjusted earnings that Lockheed says it would have earned in 2017 if tax reform had not happened -- not bad for a zero-sales-growth year.

It's also significantly more than Wall Street had expected Lockheed to promise. As of the last report, analysts who follow Lockheed were predicting the company would earn only $14 per share this year. Lockheed just promised to beat that estimate by a buck-thirty-five, or nearly 10%.

Wrapping up with a final bit of bad news

Summing up, Lockheed Martin's fourth quarter and full-year 2017 earnings report was pretty chock-full of good news, Q4 net loss notwithstanding. That's not to say, though, that Lockheed's report was entirely devoid of worrisome notes.

Chief among these: In the course of giving strong earnings guidance for 2018, Lockheed management also let slip that it expects to experience a big decline in cash flow this year. Indeed, Lockheed expects the $6.5 billion in cash it produced in 2017 to shrink by more than half in 2018, to a bit more than $3 billion.

With Lockheed Martin stock now trading for close to $102 billion in market capitalization, that means the stock now sells for close to 34 times the amount of cash flow it expects to produce this year -- a very high multiple, especially considering that we're talking about mere cash flow here, and not free cash flow, which takes cash from operations and subtracts out the cost of capital spending. (For context, capital spending in 2017 was $1.2 billion. If Lockheed spends that much again in 2018, its free cash flow for this year could be cut nearly in half, to just $1.8 billion.)

Long story short, once you factor capex into the equation, Lockheed Martin's free cash flow is going to slow to a trickle this year -- and accordingly, its price-to-free cash flow multiple will surge much higher.

True, for the time being this doesn't seem to be worrying investors. But if you're looking for something to worry about in the context of Lockheed Martin's historically expensive stock price, I think the P/FCF ratio is a good place to look.