The Senate has approved a deal that will put an end to a three-day US government shutdown.
The vote was returned with 81 in favour and 18 opposed, with Democrats providing 33 of the votes in favour.
The deadlock saw hundreds of thousands of federal employees off work without pay, and national landmarks including the Statue of Liberty closed to the public.
Republicans needed 60 votes to unlock the funds, but with only 51 of the 100 Senate seats they were reliant on Democrats to get the vote through.
Democrats agreed to drop their objections to the bill, in return for a Republican assurance to look at the Deferred Action for Childhood Arrivals (DACA) programme.
The programme – which shields more than 700,000 immigrants who entered the US illegally as children – is scheduled to end in March, following an order from President Trump last year.
Senate Republican leader Mitch McConnell had urged Democrats to end their blocking tactics, saying: "Every day we spend arguing about keeping the lights on is another day we cannot spend negotiating DACA or defence spending or any of our other shared priorities."
The stop-gap funding measure that has now been approved will allow the government to get back up and running until 8 February.
President Trump said he was pleased the Democrats had "come to their senses", but said he would only make a long-term deal on immigration "if and only if it's good for our country."
Following the vote, White House press secretary Sarah Huckabee Sanders said the President's focus was now on border security.
While she said she was "hopeful" for an agreement, she said any deal on the 'Dreamers', as the immigrants aided by DACA are known, would be tied to funding for border security, which includes Mr Trump's wall.
Sky News US Correspondent Mark Austin said: "It seems to be the Democrats who have blinked here. The issue of the children of illegal immigrants has been knocked down the road for about three weeks.
Democrats may say Trump “sat on the sidelines” . But he sat on the sidelines and won ! Dems backed down . #GovermentShutdown
— Mark Austin (@markaustintv) January 22, 2018
"There is a commitment from Republicans to try to do something about it, but no guarantee that they will.
"If an agreement is reached it would have to then pass through the House of Representatives, before being signed by Donald Trump, who is well known for saying one thing and doing another.
"Anything could happen. It's not a done deal for the Democrats, they have merely bought themselves some more time."
More from United States
If no agreement is reached by 8 February, it will go automatically for legislation in the Senate, where it will then be voted on.
President Trump is expected to travel to the World Economic Forum in Davos, Switzerland, later this week.