A lot of money goes into defending the U.S. and its global interests. The defense budget is nearly $800 billion this year, the most by a country by a wide margin. A chunk of that money goes to companies like Lockheed Martin (LMT 0.01%) and General Dynamics (GD 0.28%), which design and build weapons, equipment, and technology for the U.S. and its allies.

Both companies have been successful investments over the years, but which is the better buy today? The fundamentals of each stock make it a close race, but one arguably wins by a hair. 

Here is what you need to know.

Meeting the competitors

Lockheed Martin

One of the world's largest aerospace and defense companies, Lockheed Martin has its fingerprints all over the industry. The company operates in four primary segments: aeronautics, missiles and fire controls, rotary and mission systems, and space.

The company does more than $66 billion in annual revenue. It is known for some of the most recognizable military assets, such as the Blackhawk and Apache Helicopters and F-16 and F-35 Jets, and the Trident long-range submarine ballistic missile.

General Dynamics

General Dynamics has a trove of assets too. The company also operates four primary segments: aerospace, combat systems, marine systems, and technologies. That totals roughly $40 billion in annual revenue.

General Dynamics' aerospace segment primarily caters to private markets. Its Gulfstream brand builds private jets, and its Jet Aviation company offers a network of charters and facilities for jets. Its military products are centered around the sea and land, featuring submarines, ships, tanks like the Abrams M1, and vehicles like the Stryker.

Looking at financials

There are some interesting differences in the companies' financials. Lockheed Martin has posted a superior operating margin and return on invested capital in recent years, signaling that it has been more profitable and efficient with the money it invests into the business than General Dynamics.

Lockheed Martin and General Dynamics each pay very similar dividends. Their dividend yields are 2.7% and 2.6%, respectively, and the dividend payout ratios are virtually the same.

LMT Operating Margin (TTM) Chart

LMT Operating Margin (TTM) data by YCharts

When it comes to the balance sheet, both companies are strong. Lockheed Martin has slightly lower leverage at just over 1.5 times EBITDA, but both are comfortably below levels that should worry investors. Both companies are financially sturdy, but Lockheed Martin has the edge in profitability and use of its capital.

Which company is growing faster?

The U.S. is each company's largest customer, which ties them to the country's budget. A small number of major contractors like Lockheed and General Dynamics have historically dominated the battle over government money. However, the Department of Defense has made efforts to increase competition in recent years, seeking out smaller businesses to work with and stating intentions to monitor acquisition activity in the defense sector. As a result, revenue growth for the two defense giants has been tepid.

The good news is that the overall pie that is the U.S. defense budget should keep growing. Despite tense negotiations over America's debt ceiling, the recently agreed-upon deal should favor defense spending. The defense budget is poised to grow by 11% in 2024, and analysts believe it will continue growing through the remainder of the decade.

Analysts expect mid-single-digit revenue growth for both companies moving forward. However, General Dynamics is expected to grow faster than Lockheed Martin by a few percentage points over the next few years.

LMT Revenue (Quarterly YoY Growth) Chart

LMT Revenue (Quarterly YoY Growth) data by YCharts

This could trickle down to earnings growth, where analysts are notably more optimistic about General Dynamic's earnings growth -- a three percentage point advantage in long-term growth estimates. The company's aerospace segment recently set a revenue record in Q1 due to strong maintenance and FBO performance, and combat systems orders are at eight-year highs.

Comparing valuation

Both stocks currently trade very close to one another. Each company's price-to-earnings (P/E) ratio using estimated 2023 earnings per share shows that the stocks are valued equally, each at a forward P/E of 16.

Do they deserve the same valuation? No company is head-and-shoulders above the other -- Lockheed Martin is a more efficient and profitable company, but it's not growing as fast as General Dynamics. It seems fair that they would each fetch a similar valuation from the market.

And the winner is...

One could make a solid argument for each stock; truthfully, both are solid choices for a long-term portfolio. However, General Dynamics does have a clear growth advantage at the moment, and its private-sector aerospace segment gives it some diversification outside the constraints of government spending and the political quagmire that comes with that.

That could be enough to tip the scales in General Dynamics' favor, though again, it could easily come down to what an individual investor values more in the stocks they choose.