Trump announced the signing on his Twitter account, hailing the bill's passage in the early hours of Friday as a boost for the US military and "JOBS, JOBS, JOBS!"
The House voted 240 to 186 in support of a bipartisan package that extends funding until March 23, hours after a conservative senator forced Congress to miss a midnight deadline, sparking the shutdown.
Senator Rand Paul of Kentucky had blocked a vote in the upper house, briefly bringing the government to a halt to protest big increases in spending on the military and domestic programs.
Trump defended the deal, but said it contained "much waste in order to get Dem votes."
"Our Military will now be stronger than ever before. We love and need our Military and gave them everything -- and more," he said.
"Without more Republicans in Congress, we were forced to increase spending on things we do not like or want in order to finally, after many years of depletion, take care of our Military. Sadly, we needed some Dem votes for passage."
That is set to break the cycle of government funding crises in time for what will likely be a bruising campaign for November's mid-term elections.
But the dramatics in Congress spoke volumes about the political gridlock that defines Washington.
The rebellion that simmered among Republicans and Democrats over the budget agreement boiled over when a determined Paul brought the Senate's work to a halt.
The Kentucky Republican took the floor to blast the increase in federal spending limits, and in particular the fiscal irresponsibility of his own party.
Moving legislation swiftly through the upper chamber of Congress requires consent by all 100 members, but Paul objected.
Top Senate Democrat Chuck Schumer warned the delay put lawmakers "in risky territory," and several fellow Republicans confronted Paul in the chamber about his strategy -- but he refused to yield to allow an early vote.
Ultimately, enough members from both parties joined forces to get the temporary spending bill across the finish line, but the bill's fate in the House had been far from certain.
That agreement includes a $300 billion increase to both military and non-military spending limits for this year and 2019, and raises the debt until March 1 next year.
It also provides a massive $90 billion disaster relief package and funding to address the nationwide opioid abuse crisis.
Several fiscal conservatives in the lower chamber joined Paul in balking at adding billions of dollars to the national debt two months after passing a $1.5 trillion tax cut package.
And liberal stalwarts including top House Democrat Nancy Pelosi were also in revolt because the deal does nothing to protect immigrants known as "Dreamers," who were brought to the US illegally as children, from deportation.
She said she wanted an assurance from Ryan that he would take up the issue of immigration in the coming weeks.
"Give us a chance to allay the fear that is in the hearts of these Dreamers and their families, and remove the tears from the Statue of Liberty observing what is happening here," she said.
Democrats have sought to link the funding debate to a permanent solution for the "Dreamers," who were shielded from deportation under an Obama-era program which ended last September by Trump, who set a March 5 deadline for resolving the issue.
Disclaimer: No Business Standard Journalist was involved in creation of this content
