Updated at 7:13 p.m. ET
After facing a series of delays, the Senate approved by voice vote a one-week temporary funding measure Friday afternoon to avert a government shutdown hours before a critical deadline.
The president signed the bill Friday evening. Without it, federal agencies would have run out of money at midnight Friday.
The Senate's move came as Sen. Bernie Sanders, the Vermont independent, relented on his demands to vote first on a measure to allow direct payments to Americans.
"I am not one of the members of the Senate who shuts down, does this or does that and keeps people for weekends, I don't do that," Sanders said on the Senate floor ahead of the voice vote.
The effort de-escalates a highly dramatic scene raised in the Senate overnight, creating worries that a sequence of fights among various members could trigger a shutdown.
However, Sanders said he'll raise his demands again when the stopgap measure, also known as a continuing resolution, is set to expire in one week. And he said Congress should not go home for the holidays without addressing coronavirus relief aid.
"I am prepared to withdraw my objection at this moment, but I will not be prepared to withdraw an objection next week," Sanders said. "We will deal with the financial crisis facing tens of millions of Americans."
It was one of a series of efforts that delayed the Senate passing the legislation before Friday afternoon.
A group of Republican members were pushing for a provision to stop members of Congress from receiving pay during government shutdowns in the future.
Sen. Mike Braun of Indiana said he was among the GOP members seeking a vote on his "no budget, no pay" bill ahead of the vote on the stopgap measure. However, the measure was not addressed on the Senate floor before approval was given to the temporary funding measure.
"We're going to try to vote something out," Braun told a Capitol Hill pool reporter ahead of the voice vote.
The stopgap measure also met delays as the result of a traffic jam in the Senate.
The legislation was passed by a large majority in the House of Representatives on Wednesday. When it arrived in the Senate, it was stuck behind the National Defense Authorization Act.
That remained the case Friday.
"The Senate needs to pass a stopgap funding measure today to prevent a lapse while the bipartisan, bicameral efforts close in on a full-year funding bill," Senate Majority Leader Mitch McConnell, R-Ky., said in opening remarks Friday on the chamber floor.
Another key holdout, GOP Sen. Rand Paul of Kentucky, withdrew his demands Friday for the defense bill, saying he only wanted it held up for a day. That allowed an afternoon vote on the National Defense Authorization Act, clearing the way for the temporary funding measure.
The defense bill passed by a 84-13 vote.
"Our main point in filibustering the defense authorization bill was to point out that the president should have the prerogative to end a war, not just to start wars," Paul told a Capitol Hill reporter.
Soon after, lawmakers approved a procedural motion to allow a final vote on the defense bill. President Trump has threatened to veto the measure, but overwhelmingly majorities in both chambers have signaled support for the plan.
With now the House and Senate approving the defense bill with a veto-proof majority, it appears Congress may have the votes to override a potential Trump veto.