The $1.3 trillion spending bill was hailed by House Speaker Paul Ryan, Congress's top Republican, as marking "the beginning of a new era for the United States military," while Senate Minority Leader Chuck Schumer said it would fulfill Democratic goals.
"This critical funding bill fulfills our pledge to rebuild the nation's military," Ryan said.
Trump says will meet Putin 'in the not too distant future'
"It also addresses many of our national priorities, such as school safety, infrastructure, and fighting the opioid epidemic."
US President Donald Trump, meanwhile, lamented having to "waste money" on "Dem giveaways" to secure the military funding.
"Got $1.6 Billion to start Wall on Southern Border, rest will be forthcoming," he wrote on Twitter late Wednesday.
"Most importantly, got $700 Billion to rebuild our Military, $716 Billion next year...most ever. Had to waste money on Dem giveaways in order to take care of military pay increase and new equipment."
The monster measure, backed by Trump thanks in part to a last-minute sales pitch by Ryan at the White House Wednesday, was introduced with precious little time to act.
Government funding expires at midnight Friday night, and the House of Representatives and Senate will need to scramble if both chambers are to pass the bill and get it signed by Trump by the deadline.
The deal signals an end - or at least a pause - to the deeply partisan feuding over funding that has roiled Congress for months.
Five times since October, lawmakers have had to pass stopgap funding legislation to keep the government's lights on. Twice this year the government was allowed to slip into shutdown.
A third lapse would be deeply embarrassing for a Republican-controlled Congress facing mid-term elections in November.
The bill sets defense spending levels, including a 2.4 percent raise for troops, at $700 billion for the year - an increase of $61 billion over the 2017 cap.
Non-defense domestic spending will reach $591 billion, an increase of about 10 percent.
Among the sensitive issues addressed in the bill is gun safety, which has been the focus of prominent national attention in the aftermath of deadly school shootings.
Lawmakers said it includes a provision to strengthen compliance with background checks for firearm sales, and one that reverses what has essentially served as a ban on federal research on gun violence.
Eleventh-hour snags on multiple issues, including immigration enforcement, border security and health care payments nearly caused negotiations to grind to a halt.
The bill includes nearly $1.6 billion for construction of almost 100 miles (160 kilometers) of physical barriers and fencing along the US-Mexico border, part of Trump's promised wall.
But it fails to address protections against deportation for more than a million immigrants who arrived in the country illegally as children, an outcome likely to cause a clutch of Democrats to oppose passage.
House Democrat Luis Gutierrez said he would "not vote for funding that continues Trump's war on immigrants."
"Democrats refused to take care of DACA. Would have been so easy, but they just didn't care. I had to fight for Military and start of Wall," Trump wrote later on Twitter.
Another casualty of the last-minute haggling was a bipartisan effort to fund health care subsidies granted to insurance companies serving low-income patients.
That all but ensures that the fiery debate over Obamacare will continue into the November elections.
Moderate Republican Senator Susan Collins said it was "extremely disappointing" that the provision was left out of the bill.
"This proposal - which would lower health insurance premiums by up to 40 percent - should have been included because the stakes are so high for millions of Americans whose insurance rates will skyrocket if Congress fails to act," she said.
Several lawmakers began expressing alarm that such sweeping legislation which will touch every aspect of American life had yet to be filed by mid-day Wednesday.
Exasperated conservative House Republican Jim Jordan slammed the bill as "a bad piece of legislation" in part because it will increase the federal deficit.
But he also blasted congressional leaders for the secretive process.
"We still haven't seen the details of the legislation, and we're supposed to vote on it tomorrow?" Jordan posed to Fox News.
"That's probably not the way the American people want us to do business."
Trump's pick to lead UN agency says has trust of Muslim states
Democrats applauded increased domestic spending on infrastructure, student grants and public housing funding. The bill also maintained full funding of the Environmental Protection Agency, ignoring Trump's request to slash its budget.
Meanwhile, the bill provides $380 million to help states secure their election systems, and an additional $307 million to the FBI's budget for counter-intelligence efforts to fight Russian cyberattacks.
The House aims to vote on the bill Thursday or early Friday, then send it to the Senate. But the upper chamber's rules allow any senator to slow down the legislative process, putting the timing of passage into question.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ