Republicans and Democrats have flatly rejected most of President Trump’s 2017 budget cuts, instead linking arms Wednesday to vote for a $1 trillion spending package that spreads even more money across the vast federal bureaucracy.
The 309-118 vote in the House put Washington on track to finally have 2017 spending in place, avoiding an end-of-week government shutdown. The bill still needs final approval by the Senate and President Trump’s signature by Friday.
Congressional leaders called it the first major bipartisan victory of the Trump era and said it was a model for future cooperation. But they got there by ignoring most of Mr. Trump’s demands and instead doing what Congress does well: boosting funding for their favored programs.
“This represents today what the Congress ought to be, how it ought to work and what the American people expect,” said Rep. Steny H. Hoyer of Maryland, the second-ranking Democrat in the House.
The bill, more than seven months overdue, funds basic government operations through Sept. 30. It includes hikes for most departments and agencies, with a special focus on the Pentagon and Homeland Security — two of Mr. Trump’s priorities.
“This marks the beginning of a new era. No longer will the needs of our military be held hostage,” said House Speaker Paul D. Ryan, Wisconsin Republican.
Republicans secured those wins by agreeing to tack the additional money onto the deficit rather than cutting elsewhere, as Mr. Trump had boldly proposed in releasing his budget plans this year.
The list of Mr. Trump’s losses was extensive.
He called for canceling the Agriculture Department’s rural business grant program. Instead, it will get a 33 percent increase, to $65 million. He proposed nixing the $65 million Pacific Coast salmon recovery project, but Congress kept all $65 million intact. He called for a $75 million cut in the Western Area Power Administration, but Congress preserved the money. Mr. Trump wanted to erase $82 million for training of migrant farmworkers, but all of the funds remained in the bill. And he asked to end a grant program that pays states to clean up abandoned mines. Instead, the program received a $15 million boost.
Congress said it did recapture billions of dollars in money sitting unspent in accounts and consolidated Justice Department anti-drug grants and Education Department programs, delivering some streamlining.
The White House said it was dealt a poor hand in the negotiations, with Mr. Trump coming in so deep in a process that was supposed to have been finished nearly four months before he took office.
Press secretary Sean Spicer predicted better results in the 2018 spending debate, which begins now.
Mr. Trump has called for even deeper cuts in that bill, saying federal programs such as the National Endowment for the Arts, the Corporation for Public Broadcasting, the Legal Services Corp. and the Woodrow Wilson International Center for Scholars should all be axed.
Democrats were nearly unified behind the spending bill, with 178 of them backing the legislation and just 15 opposed.
Republicans were more divided, with 131 voting in favor and 118 opposed.
Republicans and Democrats kept dissenting voices out of the floor debate, but opponents made their displeasure known elsewhere.
“When voters chose unified Republican government in November, they didn’t bargain for Republicans ushering through an omnibus bill that keeps Obama-era spending priorities alive,” said Rep. Mark Walker of North Carolina, chairman of the conservative Republican Study Committee. “Republicans should start governing like the conservative majority party the American people elected them to be. We can and must do better for fiscal year 2018.”
Among problems Republicans cited were continued funding for Planned Parenthood and for sanctuary cities and the lack of money for Mr. Trump’s border wall.
The White House, though, insisted it made progress on the border wall.
At issue is money to upgrade 20 miles of current fencing and another 20 miles of existing vehicle barriers into the most modern bollard-style fence.
No fencing will be built on new lands, but the administration says the upgraded fencing — a project that has been going on for years but was accelerated in the bill — counts toward the president’s pledge.
“The president said he was building a wall, and he’s doing it,” Mr. Spicer said.
The 20-foot replacement fence is being built in Naco, Arizona, and Sunland Park, New Mexico. Additional sections will soon be built in San Diego, as well as in El Paso and the Rio Grande Valley in Texas, said Mr. Spicer.
Some Democrats said that even without any new footprint for a wall, the bill was still too harsh to illegal immigrants.
Rep. Luis V. Gutierrez, Illinois Democrat, said that $1.2 billion designated for immigration enforcement — the largest year-to-year hike in a decade — would end up being used to fund Mr. Trump’s “mass deportation agenda.”
“I have worked for decades with families who have complied with every order they have been given by Homeland Security and have reported to authorities like clockwork, but now they are desperate because the new president has ordered them out,” the congressman said. “I cannot turn around and bless more money for the machinery that is grinding up their families.”
• S.A. Miller contributed to this report.