[caption id="attachment_102037" align="alignnone" width="664"] We have reached a deal – Trump[/caption]
After 35 days, he backed a deal to fund federal agencies for three weeks, but it includes none of the money he has demanded for a US-Mexico border wall.
The Republican president previously vowed to reject any budget unless it included $5.7bn (£4.3bn) to fund his signature campaign pledge.
But Democrats, who control the House of Representatives, flatly refused.
Later on Friday, the Senate and House unanimously passed a bill to temporarily end the shutdown, after which President Trump signed the bill into law.
Following the votes in Congress, Mr Trump tweeted that his decision had been “in no way a concession”, but was “”taking care of the millions of people who were getting badly hurt by the shutdown”.
What did President Trump say?
Speaking in the White House Rose Garden, Mr Trump said he was “very proud to announce” the agreement, which will fund the government until 15 February.
He said federal workers affected by the political imbroglio, whom he called “incredible patriots”, would receive full back-pay.
Mr Trump also said he would not yet resort to “a very powerful alternative” – an apparent reference to declaring a national emergency.
This could divert military funding towards building a southern border wall, but such a proclamation would provoke constitutional uproar and legal challenges.
However, the president added: “We really have no choice but to build a powerful wall or steel barrier.
“If we don’t get a fair deal from Congress the government will either shut down on February 15 again.
“Or I will use the powers afforded to me under the laws and the constitution of the United States to address this emergency.”
Mr Trump accepted the deal after hearing of the shutdown’s strain on law enforcement agencies, an administration official told Reuters news agency.
The president is prepared to haggle on the $5.7bn he has been demanding for the border barrier, the same official said.