(Bloomberg) -- One good defense in this tough market may well be ... defense.

Lockheed Martin Corp., Northrop Grumman Corp. and other makers of military gear have avoided the worst of the broader stock market’s recent seven-week rout, beating the S&P 500 amid a pullback in consumer spending, tightening monetary policy and concern about a potential recession.

Russia’s longer-than-expected war in Ukraine and growing risks posed by China’s military ambitions have fostered support for greater defense outlays in the US and Europe. And those threats won’t disappear overnight, giving defense contractors a bulwark against turmoil elsewhere in the global economy.

“You’re immune from economic shock, because the market for defense goods bears no relation to commercial demand for anything in the civil economy,” said Richard Aboulafia, a managing director with consultancy AeroDynamic Advisory. 

General Dynamics Corp. rose 1.5% as of 11:15 a.m. in New York on Friday while Raytheon Technologies Corp., Northrop Grumman and Lockheed Martin shares were up less than 1%. 

An S&P index of aerospace and defense stocks posted a 2.2% gain this year through Thursday’s close compared to the 15% rout sustained by the S&P 500 Index. Lockheed Martin, the largest pure-play defense contractor in the US, led the group with a 26% rise. 

The sector’s comparison would look even better if not for Boeing Co., whose stock has plummeted about 37% this year and been a drag on the broader group. The largest US aircraft manufacturer has been burning through cash reserves as it wrestles with cost overruns on fixed-price defense contracts, an ongoing halt of 787 Dreamliner deliveries and the 737 Max jet’s stalled return in China, Boeing’s largest overseas market.

While the defense-and-aerospace sector isn’t the only S&P group doing well -- the biggest gainers in 2022 are dominated by energy companies -- it’s in the top fifth of the 158 tracked industries.

Ukraine Effect

Defense executives have largely played down near-term financial impact from the Ukraine conflict even as Russia’s brutal invasion pushed shares of several companies to record levels, creating a buffer during the market’s recent skid. 

Still, the hostilities have triggered a groundswell of military support for Ukraine that will buoy the sales outlook for years. Some 20 nations are sending more weapons to support Ukraine’s defense that eventually will need to be replenished, while spending plans telegraphed by the US and its allies could go higher.

“You’ve had a conflict that a lot of people thought initially it’s over in a week or two,” RBC Capital Markets analyst Ken Herbert said in an interview. “That’s obviously not happened. I think it’s taken a while for people to fully appreciate and price in how much upside there really is to spending.”

The U.S. Army is close to announcing a contract with Raytheon to replenish its stock of Stinger missiles drawn down to supply Ukrainian defense forces, a person familiar with the matter said Friday.

The Biden administration has sent billions of dollars worth of weaponry to support Ukraine’s defense forces, including helicopters, drones, artillery and tank-busting Javelin missiles, a joint venture of Lockheed and Raytheon. A $40 billion package of additional Ukraine aid signed by the president May 21 includes funds to replenish US arms stockpiles.

NATO Spending

Germany’s decision to spend more than $100 billion to modernize its armed forces could spur other NATO allies to follow suit, analysts at Jefferies wrote in a March client note. They estimated that every NATO member spending the recommended 2% of GDP on defense would translate to about $80 billion in incremental spending, or a 7% increase to the NATO budget. 

The longer-term force driving US defense spending, however, is China, which Defense Department Deputy Secretary Kathleen Hicks recently called “our military’s most-consequential strategic competitor and pacing challenge.”

President Joe Biden has requested to boost the Defense Department’s budget by roughly $30 billion in 2023. That proposal could have “some upside” potential, Lockheed Martin Chief Financial Officer Jay Malave said, because it may not fully account for inflation that the maker of F-35 stealth fighters is seeing, noting that was his personal view. 

Speaking at a Bank of America conference on May 19, Malave said company is “generally pleased” with Biden’s request, though “once Congress has its say, both the authorizers and appropriators, that it probably can go up from here.” 

(Updates shares from fifth paragraph.)

©2022 Bloomberg L.P.