By Steve Holland and Richard Cowan

WASHINGTON (Reuters) - U.S. President Donald Trump signed Congress' newly passed $1.3 trillion spending bill on Friday, ending several hours of confusion spurred by a tweeted veto threat that raised the specter of a government shutdown.

Trump said he had signed the bill, despite his qualms on some issues, because a $60 billion increase in military spending had convinced him it was a worthwhile compromise.

"But I say to Congress I will never sign another bill like this again," he told reporters. "I'm not going to do it again."

White House and Capitol Hill aides had been left scrambling earlier in the day after Trump criticized the six-month spending bill, despite prior assurances from the administration that he would sign it ahead of a looming midnight deadline.

"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," Trump wrote on Twitter at 9 a.m. EDT.

Trump then huddled with his senior advisers to discuss a potential veto and was advised against it, with the advisers saying he would be blamed for a shutdown and that discussions continue on the issues he is concerned about, one aide said.

By early afternoon, he appeared before reporters in the Diplomatic Reception Room of the White House to announce he had signed the measure.

"There are a lot of things I'm unhappy about in this bill," he said, patting the more than 2,000 pages of the legislation stacked on a purple box beside him.

It was unclear how seriously Republican leaders took Trump's shutdown threat. Neither Speaker Paul Ryan nor Senate Leader Mitch McConnell commented publicly on it.

Lawmakers in the Republican-dominated Senate and House of Representatives had already left Washington for a scheduled two-week spring recess, and Trump himself was scheduled on Friday to fly to Florida for a weekend at his private resort.

Story continues

IMMIGRATION CONCERNS

Trump has been frustrated that Congress has not turned over funding to make good on his campaign promise to build a wall along the U.S.-Mexico border. The bill includes $1.6 billion for six month's of work on the project but he had sought $25 billion for it.

Trump also has been at odds with Democrats in Congress over the fate of Dreamer immigrants - those brought to the United States illegally when they were children.

Trump canceled the Deferred Action for Childhood Arrivals (DACA) program that gives work permits to the Dreamers and protects them from deportation. The decision is currently tied up in court cases.

He offered to extend the protections, tied to a sweeping set of changes to immigration laws, but subsequently rejected bipartisan offers from lawmakers.

As the six-month spending budget deal was coming together, there had been reports Trump had balked at the bill and had to be persuaded by Ryan to support it.

The conservative wing of Trump's party had panned the bill because of its spending increases and some deficit hawks cheered Trump's Friday morning threat to veto it.

(Reporting by Richard Cowan and Steve Holland; additional reporting by Roberta Rampton, Amanda Becker, Susan Heavey and Patricia Zengerle; Editing by Bill Trott)