In the 20 years between the launch of the War on Terror in response to the 9/11 terrorist attacks and the collapse of the Afghan government last August, the top five defense contractors have outperformed the S&P 500, many by a wide margin.

Investing in these behemoths two decades ago would have netted you an average 580% return, compared to 332% from the benchmark index, or some 75% better. In dollar terms, $10,000 invested in each of them would have generated over $340,000 in total that time frame, for an average of $68,000 per contractor, while the broad market index would have grown $10,000 into $43,000. Not bad, but not defense-contractor level.

Soldiers at sunset

Image source: Getty Images.

Administrations come and go, but regardless of political affiliation, the nation's defense budget almost always grows, though the rate of increase may diminish from year to year (military spending actually did decrease each year between 2011 and 2015).

The U.S. defense budget was $331 billion in 2001 and has since grown to almost $732 billion today. It's a good bet it will grow even more in the decades to come, meaning defense contractors could be considered a safe investment today. 

If a recession occurs, it will have ramifications for most industries -- but the following two defense stocks may be the best way for an investor to go on the offense no matter which way the market heads.

F-35 Lightning II

Image source: Getty Images.

Lockheed Martin

There can be no discussion of a top defense stock to buy now without starting with Lockheed Martin (LMT 0.38%), the leviathan of defense contractors, which gets more defense appropriations than any other company out there. 

According to Bloomberg Government data, Lockheed received $75.8 billion in contracts in 2020. In fact, it got very nearly as much as the next three biggest contractors combined, or $76.7 billion.

Over the last two decades, Lockheed's stock returned over 700%, good enough for second best among the five largest contractors. The defense giant has also embarked on an aggressive campaign to hike its dividend payment. After holding its payout steady for three years, Lockheed began raising it every year thereafter so that it grew from $0.44 per share in 2003 to $10.20 per share, where it stands today. If Lockheed keeps this pace up, in six more years it will qualify as a Dividend Aristocrat, or a stock that has hiked its payout for 25 consecutive years or more.

The F-35 fighter jet program is Lockheed's biggest revenue generator and the world's most expensive airplane. That hasn't made the Defense Dept. or Congress very happy, and both are looking into ways to cut costs associated with it, such as replacing it altogether. While that's a risk for the contractor, one of the fighter jets they're looking to replace it with is the F-16, another Lockheed aircraft.

Lockheed saw F-35 revenue decrease $200 million in the third quarter, though that was partially offset by a $35 million increase in F-16 sales. A competitor could end up getting the next-generation fighter jet contract, which would definitely be a blow, but foreign governments also want to buy F-35s and its other aircraft, meaning investors can be assured Lockheed will still receive its share of contracts -- domestic or foreign -- in the years to come. 

Yet that is another risk to consider: Lockheed Martin is virtually 100% dependent on government contracts for its revenue. Any cuts will hit its top and bottom lines, though at 16 times trailing earnings and less than 14 times next year's estimates, which is below its historical levels, Lockheed looks cheap at this price.

Soldiers overseeing a missile launch

Image source: Getty Images.

Raytheon Technologies

It might not be a surprise that the second-largest defense contractors is the second pick for top stocks to buy. That's because what Raytheon Technologies (RTX -0.09%) makes is just as critical to the defense of the country as Lockheed's fighter jets: missile defense systems.

Raytheon makes the Patriot system, as well as Tomahawk cruise missiles. It is also developing the next generation of air-to-air missiles, the hypersonic missile, a glaring hole in the U.S. arsenal considering Russia and China have had hypersonics for years and North Korea reportedly just successfully tested one.

Raytheon's hypersonic air-breathing weapon concept also successfully launched last year, traveling in excess of Mach 5, or five times the speed of sound -- 761 miles per hour, or 1,100 feet per second.

The contractor nabbed over $28.1 billion in government contracts in 2020, putting it ahead of General Dynamics ($25.6 billion) and Boeing ($23 billion). Its stock did better than a 650% return over the last 20 years, though things get skewed in 2020 because of its merger with United Technologies and the subsequent spinoff of both Carrier and Otis.

Raytheon is a diversified contractor -- beyond just missiles and missile defense systems, it also produces aircraft control systems for commercial airlines, radar, navigation and landing systems, aircraft engines, and various weapons and munitions, as well as the space suits and space sensors that take astronauts into outer space.

The defense contractor generated over $58 billion in revenue last year, which means it is not bound to government largesse in the same way Lockheed is, though any cuts, obviously, would still hurt.

Its stock trades at 18 times earnings estimates, but also less than 2 times its expected earnings growth rate. Wall Street sees revenue growing to $86 billion by the middle of the decade, with earnings per share growing at a compounded rate of almost 23% annually for the next five years.

It might not be a hypersonic rate of growth, but it's one that should continue to put its stock into orbit.