US President Donald Trump has thrown the massive spending bill into doubt, saying he is "considering" a veto of the $1.3tn plan over concerns about young "Dreamer" immigrants and border wall money.
Hours before funding for the government expires, Mr Trump said on Twitter that he was weighing up a veto "based on the fact that the 800,000 plus DACA recipients have been totally abandoned by the Democrats (not even mentioned in Bill) and the BORDER WALL, which is desperately needed for our National Defense, is not fully funded".
I am considering a VETO of the Omnibus Spending Bill based on the fact that the 800,000 plus DACA recipients have been totally abandoned by the Democrats (not even mentioned in Bill) and the BORDER WALL, which is desperately needed for our National Defense, is not fully funded.— Donald J. Trump (@realDonaldTrump) March 23, 2018
The tweet was at odds with comments on Thursday from Mr Trump's supporters.
Budget director Mick Mulvaney had said the president would sign the bill and Republican House Speaker Paul Ryan said Mr Trump was supportive.
Congress has already left for a two-week recess. Earlier on Friday morning, the Senate gave final approval of the bill before funding for the government expires at midnight.
The Senate passage shortly after midnight averted a third federal shutdown this year, an outcome both parties wanted to avoid.
But in crafting a sweeping deal that busts budget caps, they have stirred conservative opposition and set the contours for the next funding fight ahead of the midterm elections.
The House easily approved the measure on Thursday, 256-167, a bipartisan tally that underscored the popularity of the compromise, which funds the government through September.
It beefs up military and domestic programmes, delivering federal funds to every corner of the country.
But action stalled in the Senate, as conservatives ran the clock in protest.
Once the opponents relented, the Senate began voting, clearing the package by a 65-32 vote a full day before Friday's midnight deadline to fund the government.
The omnibus spending bill was supposed to be an antidote to the stopgap measures Congress has been forced to pass - five in this fiscal year alone - to keep government temporarily running amid partisan fiscal disputes.
Leaders delivered on Mr Trump's top priorities of boosting Pentagon coffers and starting work on his promised border wall, while compromising with Democrats on funds for road building, childcare development, fighting the opioid crisis and more.
But the result has been unimaginable to many Republicans after campaigning on spending restraints and balanced budgets.
Along with the recent tax cuts law, the bill that stood a foot tall at some politicians' desks ushers in the return of $1tn deficits.
Mr Trump only reluctantly backed the bill he would have to sign, according to Republican politicians and aides, who acknowledged the deal involved necessary trade-offs for the Democratic votes that were needed for passage despite their majority lock on Congress.
"Obviously he doesn't like this process - it's dangerous to put it up to the 11th hour like this," said Senator David Perdue, who opposed the bill and speaks regularly to Mr Trump.
"The president, and our leadership and the leadership in the House got together and said, 'Look, we don't like what the Democrats are doing, we got to fund the government'."
White House legislative director Marc Short framed it as a compromise.
"I can't sit here and tell you and your viewers that we love everything in the bill," he said on Fox. "But we think that we got many of our priorities funded."
In all, 90 House Republicans, including many from the conservative House Freedom Caucus, voted against the bill, as did two dozen Republicans in the Senate.
It was a sign of the entrenched divisions that have made the leadership's job controlling the majority difficult and they are likely to be repeated in the next budget battle in the autumn.
Democrats faced their own divisions, particularly after failing to resolve the stalemate over shielding young Dreamer immigrants from deportation as Mr Trump's decision to end the Deferred Action for Childhood Arrivals programme has left it for the courts to decide.
Instead, Mr Trump won $1.6bn to begin building and replacing segments of the wall along the border with Mexico. The Congressional Hispanic Caucus opposed the bill.