WASHINGTON — House lawmakers on Wednesday overwhelmingly passed a $674 billion defense appropriations measure that President Donald Trump has promised to sign, ending any last-minute drama about a possible government shutdown.

Late last week, Trump took to social media to blast “this ridiculous Spending Bill” for including too much non-military money and no funds for his planned wall along the border with Mexico.

But on Wednesday, Trump promised that “we’re going to keep the government open." With the House’s 361-61 vote to finalize the deal, the president has until Sunday night to sign the measure and avoid any disruption in government funding.

Earlier in the day, House Speaker Paul Ryan praised the bill — which also includes full-year funding for the departments of Health and Human Services, Education and Labor — as a plan that “does a lot of the things that we all want to accomplish together.”

House Armed Services Committee Chairman Mac Thornberry, R-Texas, called the legislation an unquestioned win for the administration and the country.

“It will be a major achievement for the military,” he told reporters on Tuesday. “I think he understands the achievement of getting a big majority of discretionary money in place before the beginning of the fiscal year.

“I want his signature on the dotted line. With that, for the first time in nine years, the managers at every level of the (Defense) Department will be able to do their job without the ridiculous constraints imposed by continuing resolutions.”

Congress hasn’t finalized the new fiscal year defense budget before the start of the new fiscal year in 10 years. Instead, as lawmakers have debated spending levels, military operations have been funded for multiple months each year through extensions of the previous year budget, a process that Thornberry called harmful to national defense.

“We tend to forget that under a (continuing resolution), you’ve got to spend money on the same things this year that you did last year, whether you need it or not,” he said. “You can have no new starts. All these restrictions.

“This is a chance to finally break out of that, at a time when the world is moving fast and technology is moving just as fast.”

The defense appropriations bill has more than $606 billion in base defense spending and nearly $68 billion more in overseas contingency funds, in line with White House requests and spending targets outlined in the annual defense authorization bill approved earlier this summer.

The measure funds a 2.6 percent pay raise for troops starting next January and a boost in military end strength of 16,400 spread across the active-duty and reserve forces.

Operation and maintenance spending totals $243.2 billion of the defense total, and research and development efforts another $96.1 billion. Defense health and military family programs would receive $34.4 billion.

House Defense Appropriations Subcommittee Chairwoman Kay Granger, R-Texas, touted the bill’s investments in air superiority, shipbuilding and ground forces at a press conference beside Ryan, saying, “it all adds up to a pat on the back and money for our military.”

“The most important thing is this is the first time in ten years we’ve gotten a defense bill done on time,” she said. “Working with (Defense) Secretary (Jim) Mattis, he said the money’s important but getting it to us on time, when we have the time to plan and to build is the most important thing.”

Beyond the 77 F-35 Joint Strike Fighters authorized by the 2019 defense policy bill, the spending bill added another 16 for a total of 93. The decision comes as the Pentagon is expected to decide next month whether to move the aircraft into full-rate production.

The Navy’s shipbuilding account got a $2.2 billion boost over the $21.9 billion it asked for, including a 33rd, 34th and 35th littoral combat ship, three more than the 32-ship requirement set by the Navy.

Amphibs also fared especially well, driven both by Congress’ desire to push the Navy to a 355-ship fleet as fast as possible and by the evolving role played by amphibious ships in the Navy’s strategic thinking.

Army weapons and munitions technology development would get a big cash injection, with a $343 million boost over the Army’s $40.44 million request for research, development, technology and evaluation dollars for weapons and munitions technology.

Combined with a minibus of Veterans Affairs and military construction spending finalized earlier this month, nearly 90 percent of the federal government’s spending bills will be in place by the start of fiscal 2019, which is Oct. 1.