Lockheed Martin (NYSE:LMT) delivered strong second-quarter results, with the defense business proving to be relatively resilient during the COVID-19 pandemic.

The results continued a steady run of outperformance by Lockheed Martin, with the company's shares beating the S&P 500 by nearly 40 percentage points over the last five years thanks to an uptick in defense spending.

LMT Chart

LMT data by YCharts

The world's not getting any safer, and defense spending is unlikely to dry up any time soon. But it's an election year, and after borrowing trillions to support pandemic relief, the government could be under pressure to at least cap the Pentagon's growth, if not decrease spending in the years to come.

Lockheed Martin CEO James Taiclet on a post-earnings call with investors said that he "[tries] not to speculate" on what direction the Pentagon budget might head in the years to come, but added, "This company to me is incredibly well positioned for any reasonable range of outcomes in defense spending in the economy over the next few years."

He's right. Here's why.

Lockheed is flying high right now

There was no hint of a downturn in Lockheed Martin's most recent results. On July 21, the company reported second-quarter earnings of $5.79 per share on revenue of $16.2 billion, besting analyst expectations for $5.72 per share in earnings on revenue of $15.23 billion. Earnings per share were up 16% and revenue was up 12% year over year.

Lockheed Martin booked 1.38 times the business it billed in the quarter, with missiles and aeronautics both generating book-to-bill ratios above 1.5 times.

Post-earnings, the company raised its full-year outlook on almost all metrics. Lockheed Martin now expects to earn between $23.75 and $24.05 per share for the year on revenue of $63.5 billion to $65 billion, and expects to generate at least $8 billion in cash from operations.

LMT full-year expectations

Prior guidance

New guidance

Analyst consensus

Earnings per share

$23.65-$23.95

$23.75-$24.05

$24.17

Revenue

$62.25 billion-$64 billion

$63.5 billion-$65 billion

$63.45 billion

Source: Lockheed Martin, Yahoo! Finance.

Lockheed's portfolio is aligned with Pentagon priorities

Budget cuts typically don't occur across the board; rather, Pentagon leaders and lawmakers make difficult choices about winners and losers. Lockheed Martin is likely to hold up pretty well in that scenario.

The F-35 is the Air Force's most important weapon procurement program. The U.S. and allied governments are committed to buying thousands of airframes through the rest of the decade, even during downturns. Lockheed Martin has also established itself as a leader in hypersonics -- missiles that travel more than five times the speed of sound. The Pentagon believes that's an area where it has fallen behind both China and Russia, and thus has marked it as a priority.

Lockheed Martin-made F-22 Raptor and F-35 Lightning II flying together.

Image source: Lockheed Martin.

Lockheed's Sikorsky unit is involved in two massive competitions that will reshape the Army's helicopter fleet, and its missile business is involved in a massive restocking program after years of U.S. bombings in the Middle East. 

Lockheed Martin has a massive backlog

As of June 30, the company had a backlog of orders totaling $150 billion, up from $140 billion at the end of the first quarter. That's business that has already been contracted and put through the budgeting process, which should provide steady revenue through any downturn.

That backlog means it would take two to three years before any cuts flow down to the industrial base. Lockheed Martin thus has plenty of time to work with the customer on contingency plans in the event of cuts.

And even if some of that backlog is walked back, $150 billion provides a lot of wiggle room. Meanwhile, key programs -- including the F-35 -- are maturing. Coupled with strong demand for missiles and sales of older-generation F-16s to allies like Taiwan and Morocco, this maturation offers opportunities to boost margins even if revenue flattens.

Lockheed Martin can afford to be opportunistic

Taiclet on the call referred to "silver linings" that tend to present themselves during downturns, namely valuation declines that can lead to acquisition opportunities.

Lockheed Martin has $8 billion in cash at its disposal to go shopping. Taiclet is a veteran dealmaker from his time running American Tower (NYSE:AMT). He said Lockheed is interested in pursuing new technologies and businesses that complement Lockheed's existing ones.

We could see a deal sooner rather than later. Shares of drone maker Kratos Defense & Security (NASDAQ:KTOS) spiked higher on July 22 on rumors that Lockheed Martin could make a bid for the company.

International is growing

Upwards of 40% of the F-35s Lockheed Martin produces in the years to come will be for international customers, and other products are in demand from allies as well. In addition to those F-16 orders, Lockheed Martin also has C-130 transports and helicopters headed to India, plus Aegis missile defense systems earmarked for Japan. Growth elsewhere should help cushion any pullbacks at home.

Lockheed has seen some delays in international contracting due to the pandemic, but delivery dates are holding firm. Taiclet mentioned that regardless of budget woes, with China "getting very aggressive" and Russia "back in the game" in terms of defense spending, U.S. allies are unlikely to scale back defense spending.

Safe in any budget scenario

I'm relatively optimistic that we can avoid a budget freeze like the one that happened in 2013. No matter who wins in November, geopolitical tensions are likely to remain elevated, and politicians can ill-afford to make deep cuts to Pentagon spending despite budget concerns.

That said, the period of spending growth that Lockheed Martin and other contractors have enjoyed is likely coming to a close. In the coming years, investors looking to profit from defense will likely have to choose carefully among defense titans in order to generate strong returns.

No matter what happens in Washington, Lockheed Martin is near the top of the list of defense stocks worth buying.