WASHINGTON (AP) — Swapping crisis for compromise, the House narrowly approved $1.1 trillion in government-wide spending Thursday night after President Barack Obama and Republicans joined forces to override Democratic complaints that the bill would also ease bank regulations imposed after the economy’s near-collapse in 2008.

The 219-206 vote cleared the way for a final showdown in the Senate on the bill — the last major measure of a two-year Congress far better known for gridlock than for bipartisan achievement.

Hours before the vote, House Democratic leader Nancy Pelosi delivered a rare public rebuke to Obama, saying she was “enormously disappointed” he had decided to embrace legislation that she described as an attempt at blackmail by Republicans.

The White House stated its own objections to the bank-related proposal and other portions of the bill in a written statement. Even so, officials said Obama and Vice President Joe Biden both telephoned Democrats to secure the votes needed for passage, and the president stepped away from a White House Christmas party reception line to make last-minute calls.

In addition to the government funding, the bill also sets a new course for selected, highly shaky pension plans.

The outbreak of Democratic bickering left Republicans in the unusual position of bystanders rather than participants with the federal government due to run out of funds at midnight.

Even so, there was no threat of a shutdown in federal services — or of the brinkmanship that marked other, similar episodes. Instead, Republicans let it be known they had a companion measure providing a 48-hour extension for existing funding in case it was needed.

Hours before the mid-evening final vote, conservatives had sought to torpedo the measure because it would leave Obama’s immigration policy unchallenged. Speaker John Boehner patrolled the noisy, crowded House floor looking for enough GOP converts to keep it afloat.

He found them — after the vote to move ahead on the bill went into overtime — in retiring Rep. Kerry Bentivolio of Michigan as well as Rep. Marlin Stutzman of Indiana. The vote was 214-212.

Even so, Republican defections required Boehner and supporters of the measure to seek Democratic votes for passage. “Remember this bill was put together in a bicameral, bipartisan way,” he said. Officials in both parties said Pelosi was fully informed of the bill’s contents before it was released to the public, and did not signal her opposition.

If there was political drama in the House, there was something approaching tenderness in the Senate, where several lawmakers are ending their careers. Sen. Tom Coburn, R-Okla., choked up as he delivered a farewell speech from his desk, and Republicans and Democrats alike rose to applaud him when he finished speaking.

The spending measure was one of a handful on the year-end agenda, with the others ranging from an extension of expiring tax breaks to a bill approving Obama’s policy for arming Syrian forces fighting Islamic State forces.

The $1.1 trillion legislation would provide funding for nearly the entire government through the end of the budget year next Sept. 30, and lock in cuts negotiated in recent years between the White House and a tea party-heavy Republican rank and file.

The only exception is the Department of Homeland Security. It is funded only through Feb. 27, when the specter of a shutdown will be absent and Republicans hope to force the president to roll back an immigration policy that promises work visas to an estimated 5 million immigrants living in the country illegally.

When Congress convenes in January, Republicans will have control of the Senate for the first time in eight years and will hold their strongest majority in the House in more than eight decades.

A provision in the big bill relating to financially failing multi-employer pension plans would allow cuts for current retirees, and supporters said it was part of an effort to prevent a slow-motion collapse of a system that provides retirement income to millions.

“The multi-employer pension system is a ticking time bomb,” said Rep. John Kline, R-Minn., who negotiated the agreement privately with Democratic Rep. George Miller of California, who is retiring after 40 years in Congress.

The Pension Benefit Guaranty Corp. estimates that the fund that backs multi-employer plans is about $42.4 billion short of the money needed to cover benefits for plans that have failed or will fail.

Miller said the legislation would give retirees the right to vote in advance whether to enter a restructuring that could cut their benefits. He, Kline and others said the alternative to the legislation might be an even deeper reduction in benefits.

More than 10 million people are covered by multi-employer plans, which involve agreements between labor unions and groups of companies, mostly in construction and transportation.

The legislation drew a mixed reaction from unions and the opposition of the AARP, but the White House written statement on the legislation did not mention it as a concern.

The White House did raise objections to a provision that would roll back one of the regulations imposed on the financial industry after the economic near-collapse of 2008, and to a separate element of the bill that would permit wealthy contributors to increase the size of their donations to political parties for national conventions, election recounts or the construction of a headquarters building.

Democrats cited the same issues, but Boehner on Wednesday rejected their request to jettison either or both of the provisions. Republicans noted that 70 members of the Democratic rank and file supported easing the bank regulations on a stand-alone vote in October of last year.

Remarkably, there was relatively little controversy about the spending levels themselves that form the heart of the bill.