US Congress approved a stopgap funding bill on Thursday in a rare show of cross-party unity to keep federal agencies running past the end of the fiscal year and avert a government shutdown.
Hours ahead of the midnight deadline, the House of Representatives voted overwhelmingly to keep the lights on for another two months with a resolution that had already advanced comfortably from the Senate.
President Joe Biden later signed the resolution on Thursday evening, the White House said.
"It meets critical and urgent needs of the nation, including disaster relief for both red and blue states hit hard by Hurricane Ida and other devastating natural disasters, and funding to help us resettle Afghan allies in the United States following the end of the 20-year war in Afghanistan," Mr Biden said in a statement.
"This funding will also keep up our fight against Covid-19 and—on this International Recovery Day—it will continue our battle against the opioid crisis."
The rare example of bipartisan cooperation comes with Democratic leaders trying to hammer out a deal over Mr Biden's faltering $3.5 trillion social spending package, which has no Republican support, and a bipartisan $1 trillion infrastructure bill.
"This is a good outcome, one I'm happy we are getting done," Chuck Schumer, the top Democratic senator, told colleagues on the chamber floor ahead of the vote.
"With so many things to take care of here in Washington, the last thing the American people need is for the government to grind to a halt."
Shutdowns typically mean hundreds of thousands of government employees being sent home as federal services and properties close.
"The passage of this bill reminds us that bipartisan work is possible and it gives us time to pass longer-term funding to keep our government running and delivering for the American people," Mr Biden said in a statement.
There has never been a shutdown during a national emergency such as the pandemic, but the US Congressional Budget Office estimates that the 2018-19 stoppage wiped $11 billion from the economy.
With the threat of the shutdown off the table, Democratic leadership would be free to focus on raising the debt ceiling and passing Mr Biden's sputtering domestic agenda — a $1.2 trillion infrastructure plan and a $3.5tn spending plan.
The bills are central to the president's legacy, but both risk failing because of feuding between the Democrats' progressive and centrist factions.
Thursday's planned vote for the Senate-passed bipartisan infrastructure was delayed, with the Democratic Progressive Caucus in open revolt. House Speaker Nancy Pelosi vowed to pass the vote on Friday.
“There’ll be a vote today,” Ms Pelosi said as she departed the Capitol after midnight on Friday.
Congress is also deadlocked over the prospect of a first-ever US debt default that would erase an estimated six million jobs and wipe out $15tn of household wealth, tanking the economy.
The government is likely to run out of cash on October 18, Treasury Secretary Janet Yellen has said, unless Congress raises the federal borrowing cap.
But Republicans say they won't help, despite having pressed for hikes under former president Donald Trump, because they want no part in the Democrats' historically large package of social reforms.
The House passed a “continuing resolution” to keep funding available but the Senate shot down the plan on Monday, with Republicans objecting to a debt ceiling increase that was included in the wording.
Republicans then blocked an effort by Senate Democrats to lift the debt ceiling by a majority vote.
The Democratic-led House passed a stand-alone bill to suspend the debt ceiling until December 16 next year, with support from only one Republican. But it is doomed to fail in the Senate with no backing from the opposition.