The House of Representatives passed a stopgap measure to keep the government funded for another few months.
No Republican representative voted for the bill, which passed 219 to 206.
If such a deal had not been struck by the end of the week, the US would have automatically defaulted on trillions in government debt.
The default would have collapsed global markets and sent the world spiralling into economic chaos.
Such a default is only possible because of a mechanism used by Congress called the debt ceiling.
Under the mechanism, the US can only borrow a certain amount of money. In order to keep the government funded, Congress has to vote to raise the debt ceiling.
But citing concerns about the ballooning US deficit, Republicans in both the House of Representatives and the Senate opposed raising the debt ceiling.
The Democrats then had to negotiate a deal with them in order to stop the government from going into default.
“I’m glad that this at least allows us to prevent a totally self-made and utterly preventable economic catastrophe as we work on a longer-term plan,” Democratic Congressman Jim McGovern said.
The deal to keep the government funded only lasts until December, when negotiations will begin again.
And Republicans like Congressman Tom Cole have vowed to fight again.
“Unless and until Democrats give up on their dream of a big-government, socialist America, Republicans cannot and will not support raising the debt limit and help them pave the superhighway to a great entitlement society,” he said.
The government’s debt is currently more than US$28 trillion (AUD$39 trillion), and the government is estimated to be another US$3 trillion (AUD$4 trillion) in the red this year.
Democratic Congressman and Budget Committee chair John Yarmuth lambasted his Republican colleagues.
“The debt ceiling does not control spending. It is raised to cover debt we have already incurred,” Mr Yarmuth said.
“In this case, a lot of that debt is from the 2017 Trump tax scam.”
Because the US is considered to have excellent credit, neither party has shown much inclination to reduce the deficit while in power.
The last time the USA had a surplus budget was 2001.
In 2019 the deficit was less than a trillion dollars, but in 2020 it jumped to more than three trillion.