The Democratic leadership agreed to back the bill after accepting promises from Republicans for a debate later on the future of young illegal immigrants.
President Donald Trump, who signed the bill on Monday evening, took a swipe at Democrats.
It is the fourth temporary measure since October because Capitol Hill cannot agree a longer-term budget.
The spending bill passed the Senate by 81-18 and the House of Representatives by 266-150 earlier on Monday.
For more details: bbc.com