Washington: The US Senate announced a last-minute deal on Wednesday to avert a historic lapse in the government’s borrowing ability and a potentially damaging debt default, and to reopen the government after a two-week shutdown.

But even if the Senate and House of Representatives manage to overcome procedural hurdles to seal the deal before Thursday - when the Treasury says it will exhaust its borrowing authority - it will only be a temporary solution that sets up the prospect of another showdown early next year.

Major US stock indexes rose more than 1 percent on optimism that lawmakers were finally reaching a deal to end the weeks-long fiscal impasse.

Senate Majority Leader Harry Reid and Republican leader Mitch McConnell announced the agreement on the Senate floor, where it was expected to win swift approval after a main Republican critic of the deal, Senator Ted Cruz of Texas, said he would not use procedural moves to delay a vote.

Weeks of bitter fighting among Democrats and Republicans over President Barack Obama’s signature healthcare reform law led to a partial government shutdown on October 1, sidelining hundreds of thousands of federal workers. Cruz and other Republicans backed by the conservative, small government Tea Party movement want to repeal or delay the healthcare law.

The initial fight over the healthcare law turned into a bigger argument over the debt ceiling, threatening a default that would have reverberations around the world.

"If we don`t get a default, it would be like Y2K. People were staying up all night worried about what would happen during that deadline. Then nothing happened," said David Keeble, global head of interest rate strategy with Credit Agricole Corporate & Investment Bank in New York, referring to worries about the millennium computer bug in 2000.

Both Democrats and Republicans are confident that the US House of Representatives will have enough votes on Wednesday to pass the bipartisan Senate plan, a top Democratic aide said.

Aides to House Speaker John Boehner, the top Republican in Congress, called senior Senate staff to say the House would vote first on the measure, the aide said. The aide said it appears certain to be approved with mostly Democratic votes.

Boehner has been under fierce pressure from conservative members of the House not to call a vote relying on Democratic votes, and his job may be on the line if they continue their opposition to the Senate deal.

Lawmakers are racing against time. While analysts and US officials say the government will still have roughly USD 30 billion in cash to pay many obligations for at least a few days after October 17, the financial sector may begin to seize up if the deal is not finalized in both chambers.

"Today is definitely not the day to be conducting any serious business as traders across the globe will be hypnotized by their TVs/terminals and anxiously waiting for something to hit the news wires," Jonathan Sudaria, a trader at Capital Spreads in London, wrote in a client note.

Fitch Ratings has said it could cut the US sovereign credit rating from AAA, citing the political brinkmanship over raising the debt ceiling.

The deal that emerged on Wednesday would basically give Obama what he has demanded for months: A straight-forward debt limit hike and government funding bill.

The deal would extend US borrowing authority until February 7, although the Treasury Department would have tools to temporarily extend its borrowing capacity beyond that date if Congress failed to act early next year. It would also fund government agencies until January 15.

The budget deadlock led to federal agency shutdowns at the beginning of the fiscal year on October 1 as Obama and his fellow Democrats stood firm against changing the healthcare law.

Uncertainty over the shutdown and the debt ceiling have already taken a toll on the economy and on confidence in US assets.

Richard Fisher, the hawkish president of the Federal Reserve Bank of Dallas, told Reuters on Tuesday that "reckless" US fiscal policy will likely force the Federal Reserve to stand pat on monetary policy this month rather than reducing bond purchases the central bank has used to help support the economy.