Investors were excited about Lockheed Martin's (NYSE:LMT) second-quarter results, reported this morning, even though the company posted a drop in sales. The stock was up more than 2.5% around 1 p.m. EDT.

Net sales fell 1% in the quarter to $11.3 billion, but net income rose 3.5% to $889 million, or $2.76 per share. The good news was that cash flow and earnings guidance was increased for the full year. Management now expects operating profit of $5.375 billion to $5.525 billion, earnings of $10.85 to $11.15 per share, and cash flow from operations of over $4.8 billion.  

Part of the gain for the second quarter and full-year outlook was due to pension accounting, which can sometimes help and sometimes hurt earnings over the short term. In the second quarter. Lockheed Martin posted an $85 million pension profit, versus a $120 million expense a year ago, which makes up more than the entire rise in earnings. Long term, management is transitioning more employees to a defined contribution plan, which will keep costs fairly level quarter to quarter.

At the end of the day, the F-35 program saved what could have been a much worse quarter, pushing aeronautics sales up 13% to $3.9 billion. Sales were down in the rest of the company, and with U.S. government spending still under pressure, I think revenue will struggle for the foreseeable future. Shares are trading at 15 times earnings, which is a high price for a company that isn't growing at all at the moment.

Travis Hoium manages an account that owns shares of Apple. The Motley Fool owns shares of Lockheed Martin. 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.