(Adds Trump quote, immigration measure doubts)
WASHINGTON, Jan 22 (Reuters) - U.S. senators struck a deal on Monday to lift a three-day government shutdown as Democrats agreed to end the standoff in exchange for President Donald Trump's Republicans promising a debate on the future of young illegal immigrants.
Legislation to renew government funding easily cleared a procedural hurdle in the Senate and was expected to pass both the Senate and House of Representatives, allowing government to reopen through Feb 8.
Most Democratic lawmakers had initially opposed the funding bill, demanding that the Senate also approved protections for young undocumented immigrants known as "Dreamers."
Democratic leaders -- worried about being blamed for a disruptive shutdown -- accepted a Republican promise to hold a full Senate debate over immigration and the 700,000 Dreamers who were brought to the United States illegally as children.
Trump took a new swipe at Democrats as he celebrated.
"I am pleased that Democrats in Congress have come to their senses," Trump said in a statement. "We will make a long term deal on immigration if and only if it's good for the country."
Tens of thousands of federal workers had begun closing down operations for lack of funding on Monday, the first weekday since the shutdown, but essential services such as security and defense operations had continued.
The shutdown undercut Trump's self-crafted image as a dealmaker who would repair the broken culture in Washington.
It had forced Trump to cancel a planned weekend trip to his Mar-a-Lago estate in Florida and created uncertainty around his scheduled trip this week to the World Economic Forum in Davos, Switzerland.
Although Trump stayed in Washington, the deal to reopen the government was cut without him.
The U.S. government cannot fully operate without funding bills that are voted in Congress regularly. Washington has been hampered by frequent threats of a shutdown in recent years as the two parties fight over spending, immigration and other issues. The last U.S. government shutdown was in 2013.
Both sides in Washington had tried to blame each other for this shutdown.
Some liberal groups were infuriated by the decision to reopen the government.
"Today's cave by Senate Democrats - led by weak-kneed, right-of-center Democrats - is why people dont believe the Democratic Party stands for anything," said Stephanie Taylor, co-founder of the Progressive Change Campaign Committee.
Trump was expected to sign the legislation, which would give Congress more time to try to reach agreement on a long-term spending bill that would resolve issues including immigration, border security and spending caps.
House of Representatives Republicans have been told by their leaders to plan on voting on re-opening the government immediately.
Markets have absorbed the shutdown drama over the last week.
U.S. stocks advanced on Monday as each of Wall Street's main indexes touched a record intraday level after the shutdown deal.
"The only way politics affects what the market does is if they end of having a negative impact on the economy and corporate earnings and so far that hasnt been the case," said Michael Arone, Chief Investment Strategist at State Street Global Advisors in Boston.
A bipartisan group of more than a dozen senators, led by Republican Susan Collins of Maine and Democrat Joe Manchin of West Virginia, crowded in front of an ornate 19th century clock in a hallway outside the Senate chamber to claim credit for the breakthrough and pledge their interest in overcoming partisan gridlock.
"This represents the first time in a long time that well have the Senate actually functioning, working," said Republican Senator Jeff Flake.
While there was optimism from Senate Democratic leader Chuck Schumer that an immigration bill to protect Dreamers and bolster border security can pass the Senate, it was not clear that the more conservative House would accept such legislation.
In 2013, the Senate passed a bipartisan, comprehensive immigration bill only to see the House, controlled by Republicans, refuse to act.
For Jovan Rodriguez of Brooklyn, a Dreamer whose family came from Mexico when he was three years old and ultimately settled in Texas, the latest development was more of the same.
"Why do we have to wait - again? It's like our lives are suspended in limbo," he said. And they have been for months. I don't trust the Republicans and I don't trust (Senate Majority Leader Mitch) McConnell with just a promise. That's not good enough any more."
(Additional reporting David Morgan, Ginger Gibson, Amanda Becker, Blake Brittain, Susan Heavey, Steve Holland, Diane Bartz, Lucia Mutikani, Yasmeen Abdutaleb, Patricia Zengerle in Washington, Megan Davies in New York, Sharon Bernstein in Sacramento; Writing by Doina Chiacu; Editing by Alistair Bell)