Senate Majority Leader Harry Reid announced a deal that calls for reopening the federal government with a temporary budget until January 15 and extending US borrowing authority until February 7.
"The compromise we reached will provide our economy with the stability it desperately needs," Reid said, after working behind closed doors with his Republican rival Senator Mitch McConnell
US President Barack Obama quickly hailed the agreement and urged Congress to act swiftly to ensure that "the government reopens and the threat of default is removed," the White House said.
White House spokesman Jay Carney said Obama was grateful to the leaders of the Senate for working together and wanted lawmakers now to ensure "the government reopens and the threat of default is removed."
"We obviously hope that each house will be able to act swiftly because we're already on Day 16, I think ... of a wholly unnecessary shutdown of government with real consequences for real people," Carney added.
"And we are obviously very close to the point beyond which the United States Treasury no longer has the authority to borrow new money to meet our obligations."
US Speaker of the House John Boehner pumps his fist as he emerges from a meeting with Republican House members in the US Capitol in Washington. (Reuters Photo)
The eleventh-hour compromise still needs to pass both chambers of Congress -- including an unpredictable House of Representatives -- before it reaches Obama's desk.
The US House of Representatives will vote on deal that would prevent a US debt default, with top Republican John Boehner admitting that the "fight" is over.
Boehner, speaker in the House of Representatives said in a statement that "blocking the bipartisan agreement reached today by the members of the Senate will not be a tactic for us."
Pete Sessions, chairman of the committee that sets procedures for the House floor, said the chamber would vote on a deal worked out by Senate leaders, "but it's got to pass the Senate first."
The deal would also re-open the federal government, he said.
Signaling that a deal to avert an economic failure was finally within reach, Boehner told WLW Radio Cincinnati that there were "no reasons for our members to vote no today."
Lawmakers said they believed the legislation could pass Congress on Thursday, allowing the government to keep borrowing to meet its obligations.
US House Majority Leader Eric Cantor (C) arrives at a House Republican meeting. (AFP Photo)
"I hope that we're nearing the end of this ordeal, this impasse which never should have happened in the first place," said Senator Susan Collins, a Republican who has led efforts to broker a compromise.
On Thursday, the US economy was to sail into uncharted waters where the Treasury would no longer be able to borrow more to meet its obligations and avert a devastating debt default.
The only way to avert this peril, which could send global markets into turmoil and threaten another recession, would be for Congress to agree to raise the US government's $16.7 trillion debt ceiling.
Senate leaders hammered out their compromise after previous efforts in the Republican-led House collapsed in chaos on Tuesday.
"The American people are tired of where we are," Senator Kelly Ayotte, a Republican, said. "They're tired of the brinksmanship, and so they want us to get this resolved now for them -- today, hopefully."
Republican aides said it remained unclear exactly how the deal would navigate its way through the two chambers, but several lawmakers suggested the House would act first.
US Senator John McCain speaks to members of the media after a meeting with the Senate Republicans at the US Capitol. (AFP Photos)
If it is approved there, the deal would return to the Senate, where lawmakers hope to rapidly pass it into law.
Republican Senators Ted Cruz and Rand Paul, two vocal opponents to the deal, said they would not attempt to delay it further.
"I have no objection to the timing of this vote," Cruz told reporters.
House conservatives backed by the Tea Party movement have thus far thwarted votes on the debt ceiling and on passing a budget, demanding concessions from Obama.
Obama's Democrats have refused to allow Republicans to hold those issues to "ransom" with attempts to slash spending or dismantle the president's landmark health insurance reform.
But the Senate deal includes a mechanism that forces lawmakers into entering long-term budget negotiations, with recommendations due by December 13.
The stand-off forced the US federal government into a partial shutdown from October 1, and if it continues it would put the United states in a position where it might not be able to pay its debts.
A view of the US Capitol building at dusk in Washington. (AP Photo)
Markets have been watching the mess carefully, but have not panicked, most traders assuming that Washington will scrape together a deal before triggering global financial calamity.
US stocks surged as soon as reports began coming out from the Senate on the prospective deal.
At 1:00 pm (1700 GMT) the Dow Jones Industrial Average was up 177 points, or 1.2%, to 15,345.45, while the S&P 500 added 42 points, or 1.2%, to 1,717.93.
The Fitch ratings agency had underlined the seriousness of the situation by putting the US government's AAA credit rating on a downgrade warning, and European markets slid in morning trade.
The Senate has a Democratic majority and would back a straight vote to raise the debt ceiling.
The remaining hurdle is the House, where Republican Speaker John Boehner has proved unable to control his restive caucus.
With the Tea Party to his right insisting on standing firm, Boehner has thus far proved unwilling to use minority Democratic votes to pass even an interim budget or a temporary debt-ceiling hike.
On Tuesday, House Republicans floated a plan broadly similar to the Senate's, but which would have constrained aspects of so-called Obamacare and removed the administration's ability to use "extraordinary measures" to temporarily pay obligations beyond a debt ceiling.
It stood no chance of passing the Senate.
Republican Representative Scott Rigell said Wednesday he expected Boehner would eventually break with the hardliners and call a vote.
"I am absolutely confident of this. The speaker will do whatever is required to preserve the credit rating of the United States of America, and I will support him in that effort," he told C-Span.
Major world powers have been left looking on in dismay, unable to do anything to protect their own economic interests, with many deeply invested in US Treasuries -- hitherto seen as a safe haven.
China and Japan, which between them hold $2.4 trillion in US Treasuries, have expressed alarmed and annoyance.