US President Donald Trump has said he may veto a sweeping $1.3tn (£921bn) package to fund the government until September.
He cited a lack of immigration measures, including protections for young immigrants brought illegally to the US by their parents.
The US Senate passed the bill early on Friday, hours after the House backed it to avoid a government shutdown.
The US has already had two government shutdowns this year.
The bill needs Mr Trump’s signature by a Friday midnight deadline to keep the government funded.
But the president raised concern about the final spending bill in a tweet on Friday morning.
If Mr Trump signs, this would fund the federal government until 30 September.
The vote in the Senate early on Friday caps weeks of haggling over a number of key issues dividing lawmakers.
But the bill does not address the fate of young immigrants brought illegally to the US by their parents, a group who were protected by the Deferred Action for Childhood Arrivals (Daca) programme until President Trump ended it in September.
Mr Trump also criticised the bill for failing to provide enough funding for his promised border wall along the southern border.
What about the Dreamers?
The Daca programme had protected roughly 700,000 immigrants known as “Dreamers”. A deal on Daca was not included in the spending bill because Republicans and Democrats could not agree a trade-off.
The White House and Republicans offered Democrats a two-and-a-half or three-year Daca extension in return for including the $25b that Mr Trump wanted for the wall, reports say.
Democrats are reported to have said they would accept that, but only if a path to citizenship was created for all the 1.8m people eligible for Daca.
The White House rejected this and came back with another proposal but ultimately nothing was agreed.
“Democrats refused to take care of DACA. Would have been so easy, but they just didn’t care,” Mr Trump tweeted.
Republican Speaker of the House Paul Ryan celebrated the package as a means to enact President Trump’s policy positions.
“This bill starts construction on the wall,” he told reporters in a news conference on Capitol Hill.
“It funds our war on opioids. It invests in infrastructure. It funds school safety and mental health,” he continued.
It provides $1.6bn in funding for Mr Trump’s border wall, far short of the $25bn the White House had sought.
It also includes a provision that would legally allow the slaughter of wild horses roaming the American West as well as boosting military spending.
In a last-minute addition, it added funds to include the National Instant Criminal Background Check System (NICS) for gun sales.
It includes a 9% budget increase for the US National Park Service to address a repair backlog that advocates say are urgently needed.
“This is a necessary investment with broad returns, and we hope this trend continues,” in future spending bills, said Kristen Brengel of the non-profit National Parks Conservation Association.
Are both sides happy?
House Democratic leader Nancy Pelosi called it “a tremendous victory for the American people”.
“If you want to think you’re getting a wall, just think it and sign the bill,” she said, in a remark aimed at Mr Trump’s Republican supporters in Congress.
But despite cross-party support, at least 90 conservative Republicans objected to the measure, calling it government spending run amok.
“This omnibus [spending bill] doesn’t just forget the promises we made to voters, it flatly rejects them,” Representative Mark Meadows, head of the hardline House Freedom Caucus, said after the vote.
“This is wrong. This is not the limited government conservatism our voters demand.”