US President Donald Trump has signed a $1.3tn (£921bn) package to fund the government for six months, while vowing never to approve such a bill again.
Hours earlier, the president threatened to veto the bill over its lack of full funding for his border wall.
Congress passed the measure to avert what would have been the third shutdown of the US government this year.
But many of the president's fellow Republicans railed against the measure, one calling it "monstrous".
The spending bill needed Mr Trump's signature by a Friday midnight deadline to keep federal agencies operating until 30 September.
The president suggested in a Friday morning tweet that he might reject the 2,000-page package.
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
But in an afternoon news conference he said that despite the "ridiculous" process of passing the measure he would sign it because of its large increase in military spending.
"There's a lot of things that I'm unhappy about in this bill," he said, even though it was cleared by a Congress controlled by his own party.
He added: "I will never sign another bill like this again... nobody read it."
Mr Trump also told reporters: "I looked very seriously at the veto, but because of the incredible gains we've been able to make for the military, that over-rode any of our thinking."
The vote in the Senate in the early hours of Friday caps weeks of congressional horse-trading.
What about the Dreamers?
The bill does not address the fate of roughly 700,000 young immigrants known as "Dreamers" who illegally entered the US as children.
They were enrolled in the Obama-era Deferred Action for Childhood Arrivals (Daca) programme, but President Trump ended it in September.
Republicans and Democrats were unable to agree over the issue.
The White House and Republicans had reportedly offered Democrats a Daca extension of up to three years in return for full funding of Mr Trump's wall.
Democrats were said to have countered they would accept that only if a path to citizenship was guaranteed for all 1.8 million people eligible for Daca.
In Friday's news conference, Mr Trump said: "I do want the Hispanic community to know that Republicans are much more on your side than the Democrats who are using you for this purpose.
"The Democrats did not want Daca in this bill."
What about the wall?
President Trump said he was "not happy" with the amount allocated to construct his planned wall on the US-Mexico border.
"But it does start the wall and we will make that $1.6bn go very far," he said on Friday.
It was far short of the $25bn the White House had sought - and there are strings attached to the funding Congress has approved.
Most of it can only be used to repair stretches of the 1,900 mile (3,100km) border where there already is a wall, according to the Washington Post.
Under the bill, just 33 miles of new barriers can be built and only using "bollard" fencing or levees, not the concrete prototypes Mr Trump has viewed in photo ops, reports the newspaper.
House Democratic leader Nancy Pelosi appeared to taunt Republicans over funding for a wall, which her party firmly opposes.
"If you want to think you're getting a wall, just think it and sign the bill," she said to Mr Trump's congressional supporters.
Swamp 1 - 0 Trump
Analysis: Anthony Zurcher - BBC Washington
Donald Trump stepped up to the podium on Friday and had to walk a fine line.
He had threatened to veto the omnibus spending bill, but now he was going to sign it. He thought it was an awful bill, but it had some good parts. He said it spent way too much money, but then went through all the billions of taxpayer dollars it allocated to things he liked.
Ships! Planes! Nuclear missiles! Opioid treatment! Border security! It at times sounded like he was checking his way through an extremely high-priced shopping list.
The president warned that he would never sign a bill like this again - and that could be unintentionally true. If Democrats do well in November's midterm election, the next spending bill Congress turns out could look very different than the one produced by this Republican-controlled House and Senate.
The bottom line is Trump took the stage and essentially admitted he had been outmaneuvered - by Democrats and some members of his own party. He was elected to change the system, but he had to acknowledge that "that's the way right now the system works."
That had to be a tough thing to say.
What has reaction been?
Several people panned Mr Trump's empty veto threat.
Democratic congressman Mark Pocan accused the president of a "loser's bluff".
"Go ahead and veto the omnibus over Daca. We dare you," Mr Pocan said on Twitter. "Everyone knows you're the reason Daca recipients are abandoned."
But despite cross-party support, at least 90 conservative Republicans voted against the bill, calling it government spending run amok.
Please do, Mr. President. I am just down the street and will bring you a pen. The spending levels without any offsets are grotesque, throwing all of our children under the bus. Totally irresponsible. https://t.co/np7BmP1AkB— Senator Bob Corker (@SenBobCorker) March 23, 2018
Fellow Republican Rand Paul, who briefly shut down the government earlier this year by rejecting a bill, agreed Mr Trump "should veto this sad excuse for legislation".
He also argued lawmakers were not allowed enough time to read it.