With less than hour to spare, the Senate late Friday backed legislation averting a government shutdown as coal-state Democrats retreated on long-term health care benefits for retired miners but promised a renewed fight for the working class next year.

The vote was 63-36 and sent the stop-gap spending bill to President Barack Obama for his signature ahead of a midnight deadline.

It came hours after Democrats dropped threats to block the measure in hopes of using the shutdown deadline to try to win a one-year respite for 16,500 miners facing the loss of health care benefits at year's end. Instead, the legislation provides benefits at a cost of $45 million for four months.

Democrats evoked President-elect Donald Trump, a working class hero in coal country, in pressing for more benefits. Sen. Joe Manchin, D-W.Va., a potential member of the Trump Cabinet, led the fight of coal-state Democrats.

But House Republicans were unrelenting — and had already vacated the Capitol for a three-week holiday — forcing Democrats to concede. Manchin acknowledged Friday night that he did not have the votes to block the bill, but said "the fight will continue" next year.

"I'm born into a family of coal miners. If I'm not going to stand up for them, who is?" he asked reporters.

Manchin was meeting with Trump on Monday.

The fight gave Democrats, who suffered devastating election losses a month ago at the hands of working-class voters, a chance to cast themselves and not the GOP as the champion of the common man. Manchin was joined by other coal-state Democrats who face re-election in 2018 in states Donald Trump won last month, including Pennsylvania and Ohio.

"We're just getting warmed up," said Sen. Bob Casey, D-Pa., vowing a fight next year. "These miners and their families kept their promise, put their lives at risk. ... It's not too difficult for a senator or House member to keep a promise."

The dispute over health benefits and a separate fight over controversial legislation to shift more of California's scarce water resources to inland farmers were the final battles of a two-year session marked by constant quarreling. It was capped by a burst of productivity on legislation to authorize hundreds of water projects, repair Flint, Michigan's lead-tainted water system, and keep the government running through April.

Congress will take a break before reconvening on Jan. 3 to get a swift start on repealing key elements of the Affordable Care Act and confirming Trump's Cabinet.

The underlying funding bill would keep the government running through April 28 to buy time for the incoming Trump administration and Congress to wrap up more than $1 trillion in unfinished agency budget work. It also provides war funding, disaster aid for Louisiana and other states, and an expedited process for considering Trump's nominee for defense secretary, retired Gen. James Mattis.