US President Joe Biden has signed a bill into law which suspends the government debt limit through January 1, 2025.
US Treasury Secretary Janet Yellen had warned that the government would default as early as June 5 if the borrowing limit was not raised.
Democratic President and Congressional Republicans who want spending cuts had been locked in tense negotiations.
They finally reached a deal on May 28 to lift the limit temporarily and avoid a default.
The House of Representatives approved the bill on Wednesday and it passed the Senate on Thursday.
The White House announced that Biden signed the legislation on Saturday.
The new law keeps spending other than defense for fiscal 2024 roughly the same level as the current fiscal year.
As the government debt limit is suspended till January 2025, Biden does not have to face the issue before the next presidential election in autumn next year.
Biden: Passage of US debt ceiling bill averted economic crisis
US President Joe Biden says an economic crisis was averted with the passage of a bill to suspend the federal government's debt ceiling, just days before a potential default.
Biden addressed the public from the White House's Oval Office on Friday.
His Democratic administration continued negotiations with the Republican Party until they finally agreed to temporarily remove the government's borrowing limit until January 2025.
The House of Representatives approved the bill on Wednesday and the Senate on Thursday.
Biden said he will sign the bill into law on Saturday.
He said that if the bill had not been passed, there would have been a first-ever default in the country's 247-year history, and that would have been a catastrophe.
Biden said of the bipartisan deal that "No one got everything they wanted but the American people got what they needed." He said the country "averted an economic crisis, an economic collapse."
It was Biden's first address from the Oval Office since taking office. Reuters news agency reports that US presidents generally reserve an address from the Oval Office for the most significant and dramatic events. President George W. Bush addressed the nation from the venue after the September 11 terrorist attacks in 2001.
Biden apparently wants to highlight that he successfully overcame a historic situation as he seeks a second term.