WASHINGTON — The Republican-led Congress on Thursday evening narrowly passed a temporary spending bill to avert a government shutdown, doing the bare minimum in a sprint toward the holidays and punting disputes on immigration, health care and the budget to next year.

The measure passed the House on a 231-188 vote over Democratic opposition and then cleared the Senate, 66-32, with Democrats from Republican-leaning states providing just enough votes. President Donald Trump is expected to sign the measure.

The stopgap legislation would keep the government from closing down at midnight Friday. It has traversed a tortured path, encountering resistance from the GOP's most ardent allies of the military, as well as opposition from Democrats who demanded but were denied a vote on giving immigrants brought to the country as children and in the country illegally an opportunity to become citizens.

The wrap-up measure allows Republicans controlling Washington to savor their win on this week's $1.5 trillion tax package — even as they kick a full lineup of leftover work into the new year. Congress will return in January facing enormous challenges on immigration, the federal budget, health care and national security along with legislation to increase the government's authority to borrow money.

Each of those items is sure to test the unity that Republicans are enjoying now.

Senate Majority Leader Mitch McConnell of Ky., arrives to sign the final version of the GOP tax bill during an enrollment ceremony at the Capitol on Dec. 21, 2017 in Washington. Andrew Harnik / AP

Related: Dreamers, immigrant families ramp up pressure for Congress to pass Dream Act

"Now it gets down to some very difficult decisions on how we move forward in the first and second quarter of next year," said Rep. Mark Meadows, R-N.C., a leader of a powerful faction of hard-right Republicans. "There is a lot to do next month. I'm not worried today. I'll wait until January to be worried, OK?"

Democrats had initially pressed for adding their priorities to the measure, but once rebuffed on immigration they worked to keep the bill mostly free of add-ons, figuring that they'll hold greater leverage next month.

Among the items left behind was $81 billion worth of disaster aid, which passed the House on a bipartisan 251-169 tally but stalled in the Senate. The measure would have brought this year's tally for aid to hurricane victims in Texas, Florida, Puerto Rico and other parts of the Caribbean, as well as fire-ravaged California, to more than $130 billion. But both Republicans and Democrats in the Senate want changes, and it was among the items Democrats sought to hold onto for leverage next year.

"Democrats want to make sure that we have equal bargaining, and we're not going to allow things like disaster relief go forward without discussing some of the other issues we care about," said powerful Senate Minority Leader Chuck Schumer, D-N.Y.

Immigration is among the most difficult issues confronting lawmakers in January.

President Donald Trump rescinded a Barack Obama order giving these so-called Dreamers protection against deportation, kicking the issue to Congress with a March deadline.

"They embody the best in our nation: patriotism, hard work, perseverance," House Democratic Leader Nancy Pelosi of California told the chamber's Rules Committee on Thursday. "We should not leave them to celebrate the holidays in fear."

Trump and Republicans are pushing for additional border security and other immigration steps in exchange.

"The vast majority of Republicans want to see a DACA solution. They just want to see a DACA solution that's balanced," said House Speaker Paul Ryan, R-Wis., referring to the program's name, Deferred Action for Childhood Arrivals.