The January 2 U.S. airstrike that killed Iranian general Qassem Soleimani folded a new twist into what already figured to be a complicated year for aerospace and defense stocks. Defense contractors often come under pressure in U.S. election years, as rhetoric about cutting spending inevitably emerges, so it is typically wise to choose carefully when making investment decisions.

It's pointless for investors to try to predict what the long-term geopolitical ramifications of the strike will be, but one thing that does seem likely is that with tensions in the Middle East ratcheting up, it will be hard for whoever is in the White House to dramatically cut off-budget overseas contingency spending in the years to come. That, in turn, is generally bullish for the defense sector.

The best investors are the ones able to look beyond the near-term noise and focus on companies with sustainable, long-term advantages. However, price and sentiment do matter. Here is why Raytheon (RTN) and TransDigm Group (TDG -0.06%) are two aerospace stocks worth buying right now, and why Boeing (BA -2.87%) might be worth adding to your watch list.

Raytheon: The ideal vendor for a proxy war

Among the major prime contractors, Raytheon is the only one that doesn't make warplanes or submarines; rather the company is best known for supplying the missiles and electronics that make those platforms lethal. Assuming the conflict between the U.S. and Iran does not escalate into a full-blown war between nations but rather continued one-off strikes and proxy attacks, Raytheon is among the companies best-positioned to see more business.

A Patriot missile rockets out of its launcher in a large, open field.

A Patriot missile battery fires in the desert. Image source: Raytheon.

Many defense analysts expect Iran to retaliate indirectly, perhaps through one-off rocket attacks on U.S. assets and allies in the region or via cyberattacks. Raytheon makes the MIM-104 Patriot surface-to-air missile defense system that is deployed all over the region, as well as armaments including the Tomahawk, Sidewinder, and Maverick missiles that have been U.S. mainstays to countering threats. It also is responsible for the radars that power the THAAD ballistic missile interceptor.

Raytheon also has a large government and commercial cybersecurity business thanks to its 2015 purchase of Websense. Overall, Raytheon's product mix has consistently produced higher gross margins than those of most major contractors, and after years of firing missiles on combatants in the region, the U.S. was committed to restocking its supplies even before this latest spark.

RTN Gross Profit Margin (Quarterly) Chart

Large defense gross profit margin data by YCharts.

The mark on Raytheon's stock right now is its pending merger with the aerospace arm of United Technologies (RTX -0.35%) to create an aerospace giant with $75 billion in sales. I like the all-stock deal in the long term, but in the near term, while it awaits completion, Raytheon is largely tied to UTC's fate and the health of the non-aerospace HVAC and elevator businesses UTC plans to spin off prior to the deal's close.

However, Otis Elevator margins appear to be on the upswing, lessening the UTC risk, and the deal is on track to close this year. With UTC's non-aerospace operations less of a likely drag and Raytheon poised to benefit more than most from current events, it's an intriguing time to buy into the defense company.

TransDigm: A supplier for every season

TransDigm was among the top-performing aerospace companies of the last decade, and there is no reason to believe the momentum will fade simply because the calendar turned over. The company is a rollup of aerospace and defense spare parts and components, generating gross margins north of 45% thanks to its focus on controlling costs and its position as the only vendor able to quickly supply hard-to-find parts needed to keep airplanes flying.

TransDigm generates about three-quarters of its earnings from spare and replacement part sales instead of from supplying new production, a part of the market that tends to be less cyclical than new planes.

A plane taking off from a runway as the sun sets behind it

TransDigm shares can keep flying higher. Image source: Getty Images.

Bears have pointed to the company's software-like margins and warned that such figures make TransDigm vulnerable to price competition, but to date, the low-volume nature of many of the company's top products have made them unattractive to generic competitors focused on scale. TransDigm also has a long-term supply agreement with Boeing that minimizes margin risk, and it also demonstrates that large customers see value in doing business with the supplier despite its profit margins.

Even after the company's great run through the last decade, TransDigm shares still trade at a discount to those of rival Heico, another top performer over time, despite Heico's lower margins.

TDG Gross Profit Margin (Quarterly) Chart

TransDigm and Heico metrics data by YCharts.

TransDigm remains a consolidator and a cash-generating machine. Management says it is well on its way to integrating its $4 billion purchase of Esterline Technologies, and in 2019, it paid one-time dividends of $30 and then $32.50 per share. The company should have more than $2 billion in cash by late 2020, with which it can either make additional deals or return more cash to shareholders. This is the first stock investors should buy if they want exposure to the aerospace sector throughout the business cycle.

Boeing takes a first step

I've been hard on Boeing because of the company's handling of the 737 MAX grounding, and there's still a lot of uncertainty surrounding the company. However, Boeing's board took a giant step in the right direction in late December when it ousted CEO Dennis Muilenburg and named longtime director David Calhoun to the job.

Calhoun is an outsider but has plenty of relevant experience, including once running the aircraft division of General Electric. He's also on the boards of several large manufacturers, including Caterpillar.

The 737 MAX in flight

Boeing's troubled 737 MAX. Image source: Boeing.

Boeing has missed several self-imposed deadlines to return the MAX to service and enters 2020 still uncertain about the timetable or regulator willingness to fast-track the recertification process. Even if it happens quickly, Boeing will likely be dealing with production delays and financial charges well into 2021.

Calhoun's first big test comes in late January, when Boeing reports fourth-quarter and year-end results and will have to update its assumptions on when the MAX will fly. I'd expect him to give a blunt, and conservative, assessment in order to ease investor concerns, and I'd expect such talk to go over well on Wall Street.

There are still risks of further downside, and I'm not personally ready to buy in yet. However, Boeing has a massive backlog and an impressive portfolio of defense and commercial aerospace assets. For those with a long horizon and the ability to stomach further turbulence, it could be time to give Boeing a close look.