President Donald Trump signed the $1.3 trillion congressional budget deal into law on March 23, delivering on a promised Pentagon spending boost that has had defense stocks soaring over the past year. Shares of major contractors are up between 43% and 73% since November 2016 on expectations that Pentagon coffers would soon be overflowing.

What comes next is far from certain. The more than $700 billion allocated to defense offers ample opportunities for the contractors to win new business, but with the companies now trading well above historical average valuations, it's fair to question how much higher these stocks can run.

Huntington Ingalls (NYSE:HII) and General Dynamics (NYSE:GD) are two companies that I've singled out in the last six months as attractive investment candidates even after the price surge. Here's a look at the prospects for each over the coming quarters, with an eye toward determining which is the better buy right now.

Naval supremacy

Trump in remarks made as he signed the budget singled out the Navy for increased spending, saying funds are in place to add "a significant number of extremely advanced vessels." That's good news for Huntington Ingalls, a shipbuilding specialist and the nation's sole builder of aircraft carriers.

The USS Gerald R Ford at sea

The USS Gerald R. Ford, a product of Huntington Ingalls' Newport News shipyard. Image source: Huntington Ingalls.

The budget included more than $4 billion to Huntington to fund continued work on the USS John F. Kennedy, the second in the new Ford-class carrier series, and the company got an added boost earlier this month when the Navy expressed a willingness to explore committing to two carriers at once in the future. That's a long-term goal of Huntington CEO Mike Petters, who has argued that the labor and materials savings from doubling up would save the government money and help the company run more efficiently.

Huntington Ingalls also received $1.8 billion for the first LX(R)-class amphibious warship, an unexpected surprise after the Pentagon did not submit a request for funding the ship in 2018, as well as funding for additional guided-missile destroyer and Virginia-class submarine work.

Huntington already had a steady stream of business, with a total backlog of $21.4 billion at year-end, but this increased interest from politicians in rebuilding the Navy has led to increasingly optimistic tone coming from the company. After predicting flat revenues through 2020 as recently as November, Petters in February told investors that he could envision top-line growth of approximately 3% over the next five years.

Huntington's long-term goal is to generate margins of between 9% and 10% on its shipbuilding activities. Any upside should find its way to shareholders: The company said it plans to return substantially all free cash flow to investors through annual dividend increases and "opportunistic" share repurchases.

A bargain compared to its peers

General Dynamics was also among the winners from the budgeting process. The company is the Navy's other primary shipbuilder, and like Huntington Ingalls won additional destroyer and submarine work. The company's land systems unit also saw substantial increases over Pentagon requests, including about $1.5 billion for modifications and upgrades to Abrams tanks and Stryker armored vehicles.

M1 Abrams tank shooting a fireball.

A General Dynamics-built M1 Abrams tank. Image source: General Dynamics.

General Dynamics over the past year has been a laggard compared to other defense stocks, up "only" 20% over a period where Huntington Ingalls was up 27% and Northrop Grumman and Raytheon were up 50% and 45%, respectively.

Much of that underperformance is attributable to the company's Gulfstream commercial business, which has yet to fully recover from the 2008 recession. Fortunately, there is reason for optimism the worst is behind the business jet unit. Gulfstream reported fourth-quarter net orders up 20% year over year. And tax law changes should help spark new business jet sales by speeding depreciation.

In February, General Dynamics committed $9.6 billion to acquire CSRA to boost its government IT offerings. Post-deal, GD would operate the second largest government IT contractor; the merged business should have the scale needed to compete more effectively and the potential to extract about $200 million in annual costs from the combination.

General Dynamics CEO Phebe Novakovic earlier this year told investors that growth at her company's internal IT arm slowed in 2017 because of the impact of short-term government funding resolutions and delays related to the transition to a new administration. She said the unit's backlog remained healthy, and business began to pick up in the second half of the year, which, she remarked, "leads me to be confident that the growth in this business will materialize beginning in 2018."

Better buy: GD

Both General Dynamics and Huntington Ingalls are pricey, but both have the books of business to justify their high multiples over the next few years. General Dynamics is the better buy today because of the potential upside in the Gulfstream business. General Dynamics is also the top pick among defense primes right now.

GD, trading at about 23 times trailing-12-month earnings, is slightly cheaper than Huntington Ingalls, and trails its fellow diversified primes like Lockheed Martin, Northrop, and Raytheon by a considerable margin. That valuation gap seems very likely to close if and when the market becomes more convinced that Gulfstream is on the mend.