The US government partial shutdown is set to end after Senate Republicans and Democrats voted to approve a temporary funding bill.
Senator Chuck Schumer said Democrats would support the bill if Republicans addressed a programme that shields young immigrants from deportation.
Democrats refused to vote for the bill unless they secured protections for recipients of the Obama-era programme.
Mr Schumer said the three-day shutdown was expected to end in a few hours.
“We will vote today to re-open the government to continue negotiating a global agreement,” Mr Schumer said.
He lambasted President Donald Trump for failing to help reach a bipartisan deal, adding that he had not spoken with him since a meeting on Friday before the shutdown began.
“The great deal-making president sat on the sidelines,” Mr Schumer said.
The New York senator said he was hopeful about talks on so-called Dreamers, more than 700,000 young immigrants brought to the US as children who were protected under the Obama-era Deferred Action for Childhood Arrivals (Daca) programme.
Republican Senate leader Mitch McConnell said his party intended to consider legislation “that would address Daca, border security and related issues, as well as disaster relief”.
“We need to move forward and the first step, the very first step, is ending the shutdown,” Mr McConnell said.
What happens next?
The Senate voted to advance the bill 81-18. Though the impasse is over, the upper chamber still has to grant final approval of the bill and send it back to the House of Representatives, where it is expected to pass.
The continuing resolution provides funding to keep the government open temporarily in the hope that Congress can reach a permanent funding agreement before the 8 February deadline.
Who emerges as the victor?
Anthony Zurcher, BBC News, Washington
The shutdown is over, but the immigration and budget battles rage on. Both sides will try to claim victory, with varying degrees of success.
Republicans are thrilled that – unlike past shutdown fights – they emerged relatively unscathed. Senate Majority Leader Mitch McConnell promised an open debate and vote on protections for so-called Dreamers, but in reality that could go by the wayside if, three weeks hence, Democrats force another shutdown.
Democrats, on the other hand, can claim that they took a confrontational stand – at least for a few days – on an issue dear to their base’s heart. Whether that’s enough to satisfy the progressive hard-liners and grassroots activists is in doubt, however. A key tell is that nearly every 2020 presidential hopeful among their number voted against re-opening. For them, Mr McConnell’s guarantees are written in sand.
Meanwhile, Donald Trump was largely sidelined through the process. Democrats, and even some Republicans, complained he was impossible to pin down and unclear about his priorities. Still, a few days out of the spotlight may not have been all bad.
The American public will probably forget this long-weekend shutdown before too long. The next fight, looming only weeks away, might be different.
Why did the government shut down?
At midnight on Friday, lawmakers failed to agree on a spending bill. The bill was not a plan for funding for the whole of 2018, but would have kept things running until the middle of next month.
Efforts to reach a compromise ahead of the working week failed in a rare Senate session late on Sunday.
Democrats wanted President Trump to negotiate over immigration as part of a budget deal, but Republicans had said no agreement was possible while federal government services were closed.
Republicans wanted funding for border security – including a proposed border wall with Mexico – and immigration reforms, as well as increased military spending.
Why don’t shutdowns happen elsewhere?
In parliamentary systems, a government that can’t pay the bills doesn’t last long.
Some countries don’t even need a government to function.
After its 2010 election, Belgium went more than 500 days without elected leadership, but still avoided a shutdown.
Taxes were collected, workers were paid, and a caretaker government passed a budget.
In France – a semi-presidential system – the constitution sets out what happens when a budget isn’t passed.
The government, it says, shall “make available by decree the funds needed to meet commitments already voted for”.
Really, the question isn’t why other countries don’t shutdown. It’s why the US doesshutdown, even when there’s money sloshing round the system.
That stems from 1980 and 1981, when US Attorney General Benjamin Civiletti strictly interpreted the 1884 Antideficiency Act.
He said, in the event of a funding gap, government agencies should suspend operations – until money was appropriated by Congress.