But final passage is a formality, and after a weekend of partisan finger-pointing — in which Democrats branded the shutdown the “Trump Shutdown,” after President Trump, and Republicans branded it the “Schumer shutdown” — the vote offered both parties a way out of an ugly impasse that threatened to cause political harm to both parties.

Mr. Schumer, speaking on the Senate floor, announced that he and Senator Mitch McConnell of Kentucky, the Republican leader, had “come to an arrangement” to adopt the three-week spending measure while continuing to negotiate a “global agreement” that would include the fate of the dreamers, undocumented immigrants brought to the country as children.

Monday’s vote came after a frantic weekend of work by a bipartisan group of more than 20 senators, who on Sunday night were discussing a plan in which the government would stay open through early February, coupled with a promise from Mr. McConnell to allow a vote on a measure to protect the Dreamers from deportation.

Mr. McConnell pledged Monday morning that he would permit a “free and open debate” on immigration next month if the issue had not been resolved by then. But his promise was not enough for many Democrats, and on Monday morning, moderate Senate Democrats were still pressing for more in exchange for their votes to end the shutdown.

By the time of the vote just after noon on Monday, the moderate Democrats were predicting the vote would pass.

“We’re going to vote to reopen the government,” Senator Mark Warner of Virginia, a Democrat whose state is home to thousands of federal workers, told reporters. Mr. Warner said there was now a “path clear on how we’re going to get a full-year budget and we got a path clear on how we’re going to start an immigration debate.”

Senator Angus King of Maine, an independent who caucuses with Democrats, said he was a “strong” yes.

“I said before trust but verify,” he said of Mr. McConnell. “He made this commitment publicly in the Senate floor. He was much more specific than he was last night. And frankly I think this is an important opportunity for him to demonstrate that he will carry through.”

— Sheryl Gay Stolberg

Photo

Trump: the Democrats “have come to their senses.”

“I am pleased that Democrats in Congress have come to their senses and are now willing to fund our great military, border patrol, first responders, and insurance for vulnerable children. As I have always said, once the Government is funded, my Administration will work toward solving the problem of very unfair illegal immigration. We will make a long-term deal on immigration if, and only if, it is good for our country.”

“Put this mess behind us.”

Mr. McConnell said on Monday morning that the Senate would move ahead with a scheduled procedural vote at noon on a proposal to fund the government through Feb. 8, and he urged his colleagues to put an end to the shutdown.

“Every day we spend arguing about keeping the lights on is another day we cannot spend negotiating DACA or defense spending or any of our other shared priorities,” Mr. McConnell said, referring to Deferred Action for Childhood Arrivals, the program put in place by the Obama administration that shields young undocumented immigrants from deportation.

Mr. McConnell reiterated a pledge he offered on Sunday night that he intended for the Senate to take up immigration legislation in February if the issue has not been resolved by then. A major question as senators seek to end the shutdown is what kind of commitment Mr. McConnell is willing to make regarding the consideration of legislation for the young immigrants, a central issue in the current impasse.

On Monday, Mr. McConnell pledged that the Senate’s immigration debate would have “a level playing field at the outset and an amendment process that is fair to all sides.”

“The very first step is ending the government shutdown,” he said.

— Thomas Kaplan

Democrats wanted more than McConnell’s word.

Moderate Senate Democrats Monday morning had sought a firmer commitment from Mr. McConnell that the Senate would move to address the fate of hundreds of thousands of young undocumented immigrants, known as Dreamers, in the coming weeks.

The Democrats were part of a bipartisan group of more than 20 senators working throughout the weekend to forge a compromise to reopen the government. Mr. McConnell signaled Sunday night that he was listening to their demands, saying from the Senate floor that he intended to move ahead with immigration legislation in February if the issue had not been resolved by then.

But on Monday, Democrats wanted more in exchange for the votes to end the shutdown.

“Well I think the first thing he needs to do is strengthen his statement from last night,” said Senator Angus King of Maine, an independent who votes with the Democrats. “ ‘I intend.’ I would much rather he say, ‘I commit’ or ‘I will move.’”

As senators from the group shuffled in and out of leadership offices, Senator Jeff Flake, Republican of Arizona and another member of the group, expressed optimism that such a public statement by Mr. McConnell would be enough to win over enough Democrats to vote to end the shutdown. Some Democrats called on Mr. McConnell to delay a procedural vote schedule for noon.

The crux issue, it seemed, was whether the majority leader could be trusted to keep his word. Democrats have not forgiven Mr. McConnell for blocking the Supreme Court nomination of Merrick Garland for almost a year pending the election of a Republican to the White House. And Mr. McConnell’s promises to Republican Senators Flake and Susan Collins of Maine for votes on health care and immigration in exchange for their support of the tax cut have yet to materialize.

How much of the issue is that mistrust?

“Uh, most of it,” said Senator Joseph Manchin III, Democrat of West Virginia.

— Nicholas Fandos

Liberal activists weren’t ready to relent.

A broad array of liberal advocacy groups — including unions and immigrants’ rights activists — stepped up pressure on Democrats not to accede on Monday to any deal that does not include protections for the young undocumented immigrants known as Dreamers.

The advocates made clear that they do not trust Mr. McConnell.

“To anyone considering such a move, let me clear, promises won’t protect anyone from deportation, because delay means deportation for us,” said Greisa Martinez Rosas, advocacy director for America’s Voice, an immigrant rights group.

Moderate Senate Democrats on Monday were seeking a firmer commitment from Mr. McConnell. But the groups remained skeptical. Vanita Gutpta, the president and chief executive officer of the Leadership Conference on Civil Rights, harked back to Democrats’ vote on Friday to block a spending bill that would have kept the government open, without protecting the Dreamers.