Disagreements over the ceiling - the limit on how much the government can borrow - are not new in US politics.
But the current row between Republicans and Democrats had caused jitters in the financial markets.
There were fears that the US would default on its national debt, with catastrophic implications.
However Senate Majority leader Chuck Schumer, a Democrat, said lawmakers had reached a deal to extend the debt ceiling until early December.
The announcement came after what Schumer's Republican counterpart Mitch McConnell said were negotiations "in good faith" that had continued through the night.
The agreement comes less than two weeks before 18 October, the day the US Treasury Secretary Janet Yellen warned was the deadline to prevent the first ever US default.
The US debt currently stands at around $28 trillion (NZ $40 trillion).
The temporary debt compromise will still need to be passed by both chambers of Congress, and US lawmakers will still have to address this issue near the new December deadline to avert a default.
If the US defaulted on debts analysts say it would severely hurt the country's credit rating, plunge the global financial system into turmoil, and possibly lead to a self-inflicted recession.
What is the debt ceiling?
The US government spends more money than it collects in taxes, so it borrows to make up for the shortfall.
Borrowing is done via the US Treasury, through the issuing of bonds. US government bonds are seen as among the world's safest and most reliable investments.
In 1939, Congress established an aggregate limit or "ceiling" on how much debt the government can accumulate.
The ceiling has been lifted on more than 100 occasions to allow the government to borrow more. Congress often acts on it in a bipartisan manner and it is rarely the subject of a political standoff.
But some Republicans have voiced frustration around new spending proposals that Democrats are trying to push through without Republican support.
Democrats have pointed out that raising the debt ceiling is about paying off existing obligations rather than paying for new ones, and that President Joe Biden's policies have only contributed to 3 percent of existing debts.
- BBC