Shares of defense contractor Lockheed Martin (LMT 3.66%) rallied 3.5% on Friday, even though the S&P 500 (^GSPC -1.13%) was down 1.1%.

Lockheed and major defense contractors were up today after Israel struck Iran this morning, raising the prospect of a regional war. That sent oil prices up and most stocks down; however, the prospect that Israel or the U.S. may buy more equipment from Lockheed sent the stock of the leading defense contractor upwards.

Israel and Lockheed have history

Lockheed Martin's stock actually feel hard earlier this week, after Bloomberg reported that the U.S. Defense Department may cut its orders for Lockheed's F-35s in half in fiscal 2026, from 48 to 24 planes -- potentially putting about 5% of Lockheed's revenue at risk.

So, the lower stock price, combined with this morning's news, sent the stock rebounding. Not only is Israel a buyer of the F-35 and other Lockheed Martin defense equipment, but if the conflict escalates and the U.S. is drawn in, that could mean the Defense Department's F-35 order reduction might not be as big, or may not happen at all.

Israel is a significant purchaser of Lockheed Martin equipment for its defense, including the F-35 stealth fighter, along with Sikorsky CH-53K helicopters, AGM-114 Hellfire Missiles, and other Lockheed Martin products. In fact, Israel was the first country to use the F-35 in combat, back in 2018.

F-35 plane flies over the desert.

Image source: Getty Images.

The guns and butter (or, oil) trade worked today

Defense stocks aren't the most glamorous in the market, and they've been under some pressure this year amid the Department of Government Efficiency (DOGE) efforts and general skepticism around growing defense spending. Oil stocks, facing both secular and cyclical headwinds, have also been under pressure.

However, the reason defense and oil stocks can help balance out a diversified portfolio is days like today, when geopolitical tensions rise and the prospect of an oil supply shock rises. In those cases, most stocks go down. But defense, oil, and also gold stocks can often serve as an insurance policy in that scenario.

This is why these companies serve as a kind of hedge, while many in the space, like the 2.8%-yielding Lockheed, also pay out a dividend in the meantime.