The spending bill for the fiscal year ending Sept. 30 was approved on a largely party-line vote of 225-201, following Senate passage the previous day.
President Joe Biden said he would sign the hard-fought legislation, which also includes more aid for students with disabilities, additional funding to protect workers' rights and more job-training resources, as well as more affordable housing for families, veterans and those fleeing domestic violence.
"The bipartisan funding bill advances key priorities for our country and caps off a year of historic bipartisan progress for the American people," Biden said.
The vote marked the close, for all practical purposes, of the 117th Congress, which delivered major victories to Biden over the past two years. These included a massive COVID-19 aid stimulus bill, the first major infrastructure investment measure in years and a bill investing billions of dollars to battle climate change. A modest gun control bill also was enacted.
While some of the work was done in a bipartisan manner, that was not the case with Friday's $1.66 trillion funding bill, opposed by House Republican conservatives and some Senate conservatives. Gridlock in Congress is likely to deepen next year when Republicans take a narrow majority of the House.
The 4,000-plus page bill passed the Senate on a bipartisan vote of 68-29, with the support of 18 of the 50 Senate Republicans including Senate Minority Leader Mitch McConnell.
Just nine of the 213 House Republicans backed it.
Their leader, Kevin McCarthy vehemently opposed the bill, calling it "one of the most shameful acts" he has seen in Congress. McCarthy was present when a mob of Donald Trump supporters stormed the Capitol on Jan. 6, 2021, seeking to hang Trump's vice president.
McCarthy, who is seeking to become the next speaker of the House, has been struggling to shore up support from his most conservative Republican members.
Far-right Republicans wanted deep domestic spending cuts that this "omnibus" spending bill does not accomplish. They have threatened to oppose any legislation introduced by any of the Senate Republicans who supported the bill.
Many House Republicans had wanted to delay the negotiations on the bill until they have the majority early next year. But its passage will take a heavy load off of Republican leaders who will take control of the chamber on Jan. 3.
That will allow McCarthy to focus on his run for the powerful position of House speaker.
While the majority of his caucus supports him, a vocal minority of conservative Republicans have voiced opposition, a concern since he needs a majority of the 435-member House to support him.
Democrats are likely to support their newly selected leader, Representative Hakeem Jeffries, to be speaker in a mostly symbolic effort.
Emotions were raw on Friday.
"You all are railroading this $1.7 trillion bill full of garbage without any regard for what it's costing Americans," Republican Representative Tim Burchett said in a speech.
Like several Republicans, Burchett also attacked the attached emergency aid for helping Ukraine in its battle against invading Russian forces.
"Over $45 billion for Ukraine when Europe should be carrying the burden of these costs," Burchett said.
House Majority Leader Steny Hoyer, a Democrat, shot back: "This sweeping package is anything but garbage," adding, "it is in fact the essence of supporting our national security, our domestic security and the welfare of our people."
The legislation would provide the Defense Department with a record $858 billion, up from $740 billion last year.
National security concerns prompted legislators to include a provision to ban the use of Chinese-owned social media app TikTok on federal government devices.
Around $800 billion would be designated for the array of non-military programs, $68 billion over fiscal 2022.
Ukraine would get $44.9 billion in new emergency U.S. aid. The debate in Congress over the bill was punctuated by a visit on Wednesday by Ukraine President Volodymyr Zelenskiy, who thanked Americans for bolstering his country's war effort against Russia and argued the U.S. funds were a good "investment."
Other major spending items in the bill include over $27 billion for the victims of natural disasters, a major increase in funding for those struggling with drug addiction and funding to help carry major infrastructure projects made possible by a bill enacted in 2021.