I learned a simple, but important, investing lesson last week by reading Raytheon's (NYSE: RTN) second-quarter earnings report: Never, ever forget to look at margins.

With earnings season in full swing, investors often focus on total sales and organic sales growth. Both are undoubtedly important to any business, but they never tell the whole story. As a case in point, let's dig into Raytheon's numbers.

Anybody want to buy a missile?
Raytheon, one of the largest defense contractors in the world, claimed to have a "solid second quarter," but reported a 3.4% year-over-year drop in total sales. Sales for the company's network centric systems division, which manufactures systems for combat and air traffic control, fell 15.2% year over year. Raytheon's technical services segment also had a big drop of 3.5% compared to Q2 2011, and sales declined in three other divisions at the company. Only the sales from the space and airborne systems group grew this quarter compared to last year, increasing by 2.5%. This didn't sound "solid" to me at all.

Raytheon isn't the only defense contractor that experienced shrinking sales. Northrop Grumman (NYSE: NOC), best known for manufacturing the B-2 bomber, reported a 4.4% year-over-year drop in sales. United Technologies (NYSE: UTX), which recently acquired Goodrich, also experienced a 4.6% decline in sales compared to Q2 2011.

Pentagon closing its wallet
Much of the sales attrition is due to U.S. government plans to cut the defense budget. The Department of Defense has already announced it will trim nearly $490 billion from its payouts over the next 10 years, and another half-trillion dollars will automatically be cut this upcoming January if Congress does nothing to stop sequestration. In Raytheon's case, these planned cuts may have already resulted in some lower sales to U.S. Navy and Army programs.

Never fear, margins are here!
Considering all of this information, I thought Raytheon was in trouble -- until I looked at the metric that I tend to ignore way too often.

The company's operating margin, which reflects how much it earns before interest and taxes for every dollar of sales it rakes in, rose to 12.4% this quarter. This was a dramatic improvement on its 10.8% operating margin in Q2 of fiscal 2011, which reflects important cuts in both cost of goods sold and selling, general, and administrative expenses. As a result, Raytheon's year-over-year net income rose by 5.6% despite lagging sales.

Let's look at how other companies in this sector did with their margins this quarter:

Company

Operating Margin for Q2 2012

Operating Margin for Q2 2011

Raytheon 12.4% 10.8%
General Dynamics 12.2% 12.0%
Northrop Grumman 12.3% 12.8%
United Technologies 15.8% 13.9%
Lockheed Martin 9.5% 9.4%

Sources: Company earnings reports for Q2 2012.

These companies were able to improve their margins this quarter (with the exception of Northrop Grumman). As you might expect, Northrop Grumman was also the only company in this group to report lower net income compared to Q2 2011.

Up, up, and away
Despite the upcoming U.S. defense budget cuts, I think the defense industry is a good long-term investment, and Raytheon is definitely a company to watch in this space. It will continue to generate income from domestic contracts, such as its recent $90 million deal to provide systems for the Federal Aviation Administration. International markets also represent huge opportunities for growth. Raytheon recently landed a $925 million contract for a joint U.S.-Japan missile system and reported a $134 million deal to provide Patriot missiles for an unidentified non-U.S. customer.

I expect Raytheon to outperform the market over the next five years, and just made that call on my Motley Fool CAPS page. In any case, I'll be paying close attention to its margins in upcoming quarters.

Defense and aerospace stocks can be a great play for long-term investors who love dividends. Curious to see which dividend stocks our top analysts recommend? Read our free report to find out: "Secure Your Future With 9 Rock-Solid Dividend Stocks."