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, who signed the measure early Saturday morning. The Senate also passed and sent the president a $10 billion water bill with money for the California drought. The vote was 78-21.

The votes came hours after Democrats dropped threats to block the spending 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.

The trucking lobby won permanent relief from recent Transportation Department rules mandating more rest and overnight breaks for long-haul drivers, though the White House and Main Street Republicans were denied in a bid to revive the Export-Import Bank's ability to approve export financing deals exceeding $10 million.

The miners' issue had history. Seventy years ago, President Harry S. Truman guaranteed a lifetime of health and pension benefits for retired miners to avert a strike.

Majority Leader Mitch McConnell, R-Ky., said the four-month extension was better than nothing. McConnell himself represents thousands of miners in the struggling coal industry and said he tried to get a longer solution in talks with House Speaker Paul Ryan, R-Wis.

"Would I have preferred that provision to be more generous? Of course I would have," the Republican said in a speech on the Senate floor.

The House had left town on Thursday, creating a dynamic in which the Senate had little choice but to adopt the stopgap measure. Both the funding measure and a water projects bill passed there by sweeping bipartisan votes.

Democratic opponents of the popular water projects bill, led by Sen. Barbara Boxer, D-Calif., assailed provisions to divert more water to corporate farmers. The bill also authorizes long-delayed funding of $170 million to help Flint, Michigan, to fix its lead-tainted water system.

Democrats griped that GOP negotiators on the water bill dumped a permanent "Buy America" provision requiring U.S.-produced steel be used in water projects. But that effort lost steam Friday.

The spending bill also would provide $7 million to reimburse the New York Police Department for the cost of security around Trump Tower in Manhattan, far less than the $35 million the city requested.

