The key vote came in the Senate, where most members supported a key procedural vote to let the funding bill proceed without a filibuster. The cloture vote easily cleared the 60-vote threshold with a final vote of 81 to 18. Two Republicans, Sens. Rand Paul and Mike Lee, voted against the measure, as did 16 Democrats.
The deal will keep the government funded until February 8, eight days earlier than the date in the House-passed funding bill that the Senate rejected on Friday.
The final bill passed in the Senate a few hours later with the same vote as the cloture measure. The delay between the cloture vote and the final vote was due to members working out language that will allow federal workers to receive back-pay for the days the government was closed, per reports.
The House then agreed to the deal, passing the measure shortly after the Senate by a vote of 266 to 150. 45 Democrats voted for the funding bill, while six Republicans crossed party lines to vote no.
President Donald Drumpf can now sign the bill and reopen the government.
"It takes some special effort not to be cynical about the shutdown of the Federal government. Likely there are lots of Americans who wish the whole thing (except Defense and Air Traffic Control) would take a few months off anyway. I note that I have several family members and friends who work for the Federal government and they were told Friday to come to work - that it wasn't all being shut down. And I read that this administration was taking efforts to mitigate it the best they could, unlike last time. Truthfully, most of us didn't notice it last time and few will this time."
Drumpf weighed in on the deal following the cloture vote with a statement partially committing to an immigration deal.
"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," Drumpf said. "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."
Given Drumpf's wild change of hearts during the immigration discussion, it is unclear what exactly a deal that is "good for our country" would look like.
The impasse was broken after Senate Majority Leader Mitch McConnell agreed to hold an open debate process on a bill to codify the Deferred Action for Childhood Arrivals immigration program. Securing a vote on DACA was a key priority for Democrats, but the deal with McConnell appears to have fallen short of the party's original request.
Despite McConnell's commitment, there is nothing binding the House to the deal. A 2013 immigration bill received bipartisan support in the Senate but never made it to the floor of the House.
McConnell previously promised Republican Sen. Jeff Flake there would be a DACA vote by the end of January, which does not look likely.
Schumer said that if McConnell did not hold a good-faith vote on the DACA issue by February 8, the Republican leader "will have breached the trust" of Senate Democrats.
"The Republican majority now has 17 days to keep the Dreamers from being deported," Schumer said, referring to DACA recipients.