Shares of Northrop Grumman were among the few stocks to gain on Friday as aerospace companies climbed in the wake of the killing of Iranian Major General Qassem Soleimani.

Shares of defense contractor Northrop Grumman NOC, +0.10% were up 5.1% in Friday afternoon trading, while those of another defense company, Lockheed Martin, gained 4.1%.

Shares of companies in the aerospace and defense sector tend to benefit during heightened potential for military conflict and have been viewed by Barron’s as an attractive sector, even before the recent rise in Middle East tensions.

Read:Who was Qassem Soleimani, and why is his death a major development in U.S.-Middle East relations?

On Friday, the iShares U.S. Aerospace & Defense ETF was a good way to play the broader sector, with that exchange-traded fund up 0.9%. The ETF is a market-cap weighted fund, with its top holdings represented by Boeing Co., at 20.8% of the fund, United Technologies Corp. US:UTX, 16.8%, Lockheed, 6.7%, TransDigm Group TDG, +0.02% 5% and Raytheon Co. US:RTN, about 5%.

Also see:Here’s a look at the biggest movers among U.S. oil stocks after Iran’s Soleimani is killed

In 2019 Northrop returned 43% while Boeing’s shares returned 3.3%, according to FactSet data.

By comparison the S&P 500 SPX, -0.84% index gained 28.9% in 2019, the Dow Jones Industrial Average DJIA, -0.46% finished with a 22.3% advance and the Nasdaq Composite Index COMP, -1.26% gained 35%.

Another popular way to bet on the defense and aerospace sector is SPDR S&P Aerospace & Defense ETF XAR, +0.53% , which was up 1.5% on Friday. The fund is equal-weighted, which means that all of its more than 30 constituents have an equal influence on the return for the overall ETF, compared with a market-weighted fund, which moves in line with components that have the largest market values.

Some of its notable components include, Huntington Ingalls Industries Inc. HII, +1.79% , Axon Enterprise Inc. AAXN, -1.07% , Arconic Inc. ARNC, -0.51% and Teledyne Technologies Inc. TDY, +0.88% . The fund outperformed the broader market in 2019 and was up 38.3%.

Check out:Why the oil market rally on elevated U.S.-Iran tensions may be short lived