Media playback is unsupported on your device Media caption President Barack Obama: "It's an important first step to ensure... we live within our means"

President Barack Obama has signed legislation to increase the US debt ceiling and avert a financial default, after Congress voted in favour of a bipartisan compromise deal.

The bill cleared its final hurdle in the Senate by 74 votes to 26, after negotiations went down to the wire.

It raises the debt limit by up to $2.4tn (£1.5tn) from $14.3tn, and makes savings of at least $2.1tn in 10 years.

But the bill's passage failed to lift financial markets.

On Wall Street stocks ended Tuesday down by more than 2%, amid poor consumer spending data for June.

Japan's Nikkei index followed suit, finishing Wednesday morning down by about the same amount.

Moody's rating agency reacted to the bill by placing Washington's AAA credit score under a "negative outlook". Chinese credit agency Dagong downgraded its rating of the US from A+ to A, Xinhua news agency reported.

President Barack Obama has been humiliated and blown off course by the Republican victory, compelling him and his party to swallow deep spending cuts. Read more from Mark

The bill's signing came just 10 hours before the expiry of a deadline for Washington to raise its borrowing limit, after drawn-out talks between Republicans, Democrats and the White House.

Without a deal to raise the debt ceiling, the US would have been unable to meet all its bills, the treasury department had warned.

Speaking at the White House shortly after the decisive vote in the Senate, President Obama said it was "pretty likely that the uncertainty surrounding the raising of the debt ceiling for businesses and consumers has been unsettling".

"It's something we could have avoided entirely," he added.

The president said more action was needed, saying it was impossible for the US to "close the deficit with just spending cuts".

He urged Congress to now look to boost the economy through measures to create jobs and increase consumer confidence.

"We can't balance the budget on the backs of the very people who have borne the biggest brunt of this recession," President Obama said, reprising one of his key themes of recent weeks.

Lawmakers lament

In Tuesday's Senate vote, the bill was opposed by six Democrats and 19 Republicans.

Some Democratic and Republican lawmakers have bitterly opposed the legislation in recent days, saying it offered too much of their opponents' agenda.

Media playback is unsupported on your device Media caption Top Democrat and ex-Republican aide discuss Obama's prospects

But the legislation still received many of their votes in the House and Senate as lawmakers heeded warnings that the US would default on its debts if Congress did nothing.

"This is a time for us to make tough choices as compared to kick the can down the road one more time," Republican Senator Jerry Moran said following the vote.

Speaking after the vote in the Senate, Democratic majority leader Harry Reid echoed the discontent of some in Congress, saying "neither side got all it wanted, each side laments what it didn't get".

"Today, we made sure that America will pay its bills, now it's time to make sure all Americans can pay theirs," Mr Reid added.

Before the bill's passage, Senate Republican leader Mitch McConnell praised the outcome, saying: "Together, we have a new way of doing business in Washington."

The legislation passed in the House of Representatives by a clear majority on Monday evening.

Triggers in place

The compromise package deeply angered both right-wing Republicans and left-wing Democrats.

Liberals have been unhappy that the bill relies on spending cuts only and does not include tax rises for the wealthy, although Mr Obama could still let Bush-era tax cuts for the top brackets expire in January 2013.

House Republicans were displeased that the bill did not include more savings.

In a key point for President Obama, the bill raises the debt ceiling into 2013 - meaning he will not face another congressional showdown on spending in the middle of his re-election campaign next year.

The deal will enact more than $900bn in cuts over the next 10 years.

It will also establish a 12-member, bipartisan House-Senate committee charged with producing up to $1.5tn of additional deficit cuts over a decade.

Analysts have said the cuts will probably come from programmes like federal retirement benefits, farm subsidies, Medicare and Medicaid.

Economists have said that failure to pass the debt deal would have shaken markets around the globe.