The Senate on Friday passed legislation to fund the federal government until April 28, avoiding a government shutdown by less than an hour.

The measure passed 63-36 after a group of disgruntled Democrats backed away from their threats to block or delay the funding measure because of a dispute over healthcare benefits for retired miners.

President Obama signed the bill in the early morning hours Saturday, the White House said in a statement.

ADVERTISEMENT

The legislation marks the final major business of the 114th Congress and caps the first two years of Sen. Mitch McConnell Addison (Mitch) Mitchell McConnellPelosi: Trump hurrying to fill SCOTUS seat so he can repeal ObamaCare Senate GOP aims to confirm Trump court pick by Oct. 29: report Trump argues full Supreme Court needed to settle potential election disputes MORE’s (R-Ky.) tenure as Senate majority leader.

“This Congress, the Senate has passed nearly 300 bills, and nearly 200 of those are now law,” McConnell said on the floor before the vote. “But what really matters isn’t the number of bills passed, it’s what we can achieve on behalf of the American people. And by that standard, I’m incredibly proud of what we’ve been able to accomplish for our country.”

The bill, which passed the House earlier in the week, sets up a spending fight next year within President-elect Donald Trump Donald John TrumpOmar fires back at Trump over rally remarks: 'This is my country' Pelosi: Trump hurrying to fill SCOTUS seat so he can repeal ObamaCare Trump mocks Biden appearance, mask use ahead of first debate MORE’s first 100 days in office that will test his promise to cut deeply into the federal deficit by eliminating what he calls “tremendous waste, fraud and abuse.”

Senators will have to reach an agreement by late April on spending levels for the rest of fiscal year 2017 while juggling the confirmations of various executive branch nominees and perhaps a Supreme Court nominee. They will also be working on regulatory reform and a budget to pave the way for tax reform.

Republican senators, including members of the leadership, had hoped Trump would instead accept a yearlong omnibus spending bill or a yearlong stopgap funding resolution to clear the decks for 2017 for those other priorities.

Any deep cuts to social programs pushed by Trump next year, or increases in defense spending not matched by increases in domestic spending, are likely to draw staunch opposition from Democrats.

ADVERTISEMENT

The four-month funding bill that passed Friday evening was initially expected to sail through the Senate after it won the early support of leaders on both sides of the aisle. Things took a turn, however, when a group of Democrats facing reelection in 2018 from coal-mining states began voicing loud objections.

Sen. Joe Manchin Joseph (Joe) ManchinThe Hill's Morning Report - Sponsored by Facebook - Trump, GOP allies prepare for SCOTUS nomination this week Trump meets with potential Supreme Court pick Amy Coney Barrett at White House Names to watch as Trump picks Ginsburg replacement on Supreme Court MORE (D) of West Virginia, who faces a tough race in 2018 in a state Trump carried with 68 percent of the vote, led a last-ditch effort to convince Democratic colleagues to vote against the funding bill because it included only a four-month extension of health benefits for miners.

He was joined by Sens. Sherrod Brown Sherrod Campbell BrownSenate Democrats release report alleging Trump admin undermined fair housing policies Bipartisan praise pours in after Ginsburg's death Emboldened Democrats haggle over 2021 agenda MORE (D-Ohio), Heidi Heitkamp Mary (Heidi) Kathryn HeitkampCentrists, progressives rally around Harris pick for VP 70 former senators propose bipartisan caucus for incumbents Susan Collins set to play pivotal role in impeachment drama MORE (D-N.D.), Bob Casey Robert (Bob) Patrick CaseySecond GOP senator to quarantine after exposure to coronavirus GAO report finds brokers offered false info on coverage for pre-existing conditions Catholic group launches .7M campaign against Biden targeting swing-state voters MORE (D-Pa.) and Claire McCaskill Claire Conner McCaskillMomentum growing among Republicans for Supreme Court vote before Election Day Democratic-linked group runs ads in Kansas GOP Senate primary Trump mocked for low attendance at rally MORE (D-Mo.), who all have tough reelection battles in pro-Trump states in 2018.

They wanted to amend the stopgap to include a yearlong extension of benefits but made little progress.

They lobbied their colleagues vigorously, but other Democrats didn’t want to risk even a temporary government shutdown.

Many of them viewed using the threat of a shutdown as leverage as a distasteful tactic associated with firebrand conservative Sen. Ted Cruz Rafael (Ted) Edward CruzTrump argues full Supreme Court needed to settle potential election disputes Press: Notorious RBG vs Notorious GOP The Hill's Morning Report - Sponsored by Facebook - Washington on edge amid SCOTUS vacancy MORE (R-Texas).

McConnell pushed back against Manchin by arguing the legislation had passed overwhelmingly in the House with bipartisan support. He noted that House lawmakers had already left town, effectively quashing the chances of a renegotiation.

“While some Senate Democrats may want to delay into a shutdown, House Democrats overwhelmingly rejected that approach,” he said, pointing out the bill includes funding for troops in Afghanistan and other popular priorities.

Manchin argued that by extending miners’ benefits for only four months, lawmakers were giving short shrift to the working-class families they extolled during this year’s campaign.

“I rise today fighting for the working men and women that we all use in our commercials. Every one of us goes out and basically tries to attract working men and women to vote for us because we say we’re coming here to fight for you,” he said on the floor.

It became clear earlier Friday that Manchin didn’t have the 41 votes he needed to block the bill indefinitely. He still, however, could have forced a temporary government shutdown by raising procedural objections to delay it until Saturday or Sunday.

The drama ended around 7 p.m. Friday evening when Sen. Mark Warner Mark Robert WarnerIntelligence chief says Congress will get some in-person election security briefings Overnight Defense: Trump hosts Israel, UAE, Bahrain for historic signing l Air Force reveals it secretly built and flew new fighter jet l Coronavirus creates delay in Pentagon research for alternative to 'forever chemicals' House approves bill to secure internet-connected federal devices against cyber threats MORE (D-Va.), who joined Manchin and other Democrats on the floor to criticize the continuing resolution, conceded, “We are not going to shut down the government over this issue.”

The measure includes $170 million to overhaul the infrastructure of communities with contaminated drinking water, such as Flint, Mich., where lead-tainted water became a national scandal earlier this year.

It also includes $4.1 billion in disaster relief to rebuild areas inundated by floods caused by Hurricane Matthew and other storms, including parts of Florida, Georgia and South Carolina.

More than $870 million in the measure goes to fund the 21st Century Cures Act, a bill designed to spur medical research.

The Cures bill passed both chambers recently and has the support of Vice President Joe Biden, whose “moonshot” project to “eliminate cancer as we know it” would receive funding.

Shortly before final passage, Sen. Barbara Mikulski Barbara Ann MikulskiForeign policy congressional committees need to call more women experts Lobbying World Only four Dem senators have endorsed 2020 candidates MORE (Md.), the senior Democrat on the Appropriations Committee, praised the legislation for funding the repair of water infrastructure in Flint and the treatment of opioid addition. She noted that Democrats kept it free of poison-pill riders.

“I’m just sorry that it only funds the government to April,” she said.