UPDATE 4-Trump threatens to veto spending bill, raising gov't shutdown risk

(Adds context and background)

WASHINGTON, March 23 (Reuters) - U.S. President Donald Trump made a surprising threat to veto Congress' newly passed $1.3 trillion spending bill, a move that raised the specter of a possible government shutdown ahead of a midnight Friday deadline to keep federal agencies open.

In a tweet on Friday morning Trump said he was displeased about immigration issues in the bill, even though the White House had given assurances on Thursday that he would sign it. Lawmakers in both the Senate and House of Representatives had left Washington after passing the measure.

"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.

Trump has sought to make good on his campaign promise to build a wall along the U.S.-Mexico border. He 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.

There was no immediate comment from the White House or Republican leaders in Congress on Friday. Trump is scheduled to leave later in the day for a weekend at his private resort in Palm Beach, Florida. (Reporting by Richard Cowan and Steve Holland; additional reporting by Roberta Rampton and Susan Heavey; Editing by Bill Trott)