Media playback is unsupported on your device Media caption Olli Rehn and Christine Lagarde say Greece has kept its commitments

Eurozone finance ministers and the IMF have reached a deal on an urgently needed bailout for debt-laden Greece.

They have agreed to cut debts by 40bn euros ($51bn; £32bn) and have paved the way for releasing the next tranche of bailout loans - some 44bn euros.

Greek Prime Minister Antonis Samaras welcomed the deal, saying "a new day begins for all Greeks", but it was condemned by the main opposition party.

European and Asian shares and the euro all climbed on news of the agreement.

The German Dax and French Cac 40 indexes each rose by 0.8% at the start of trading on Tuesday, while in London the FTSE 100 gained 0.6%, reversing losses from Monday.

In Asia, the MSCI's broadest index of Asia Pacific shares outside Japan gained 0.3% to its highest level in more than two weeks. Australian shares rose 0.7%, while South Korea's benchmark Kospi index was up nearly 0.9%.

The euro reached its highest level against the dollar since 31 October, up about 0.2% to $1.30.

'Credibility test'

The breakthrough came after more than 10 hours of talks in Brussels. It was the eurozone's third meeting in two weeks on Greece.

Analysis The deal has prompted mixed reactions here. Many Greeks will see only the price tag attached: years of crippling austerity, with no sign yet of growth. And targets may still be missed, given the deep recession. But the government - and its supporters - are immensely relieved. The prime minister had laid his survival on the line. Securing the money and more time to cut Greece's debt will be seen as a vital vote of confidence from its lenders - a commitment to its continuing membership of the euro. The daily Ta Nea calls it the "first smile for Greece". One senior banker told me recently two things drive the markets: fear and greed. For now, fear of a "Grexit" still drives away investors. But with the bailout cash, perhaps that fear may recede, greed may return, and investment may slowly dribble back to Greece. But it'll be a long, hard road ahead.

The deal opens the way for support for Greece's teetering banks and will allow the government to pay wages and pensions in December.

The leader of the eurozone finance ministers' group, Jean-Claude Juncker, said Greece would get the next instalment of cash on 13 December.

Greece has been waiting since June for the tranche, to help its heavily indebted economy stay afloat.

European Central Bank (ECB) president Mario Draghi said the bailout would "strengthen confidence in Europe and in Greece".

For his part, Mr Juncker said the deal did not just have financial implications.

"This is not just about money. It is the promise of a better future for the Greek people and for the Euro area as a whole."

Greece's international lenders have agreed to take steps to reduce the country's debts, from an estimated 144%, to 124% of its gross domestic product by 2020.

These include cutting the interest rate on loans to Greece, and returning 11bn euros to Athens in profits from ECB purchases of Greek government bonds.

Ministers have also agreed to help Greece buy back its own bonds from private investors.

Greece has been granted another breathing space. There will be no "Grexit" - no Greek exit. The markets should like that

So far the ECB, IMF and the European Commission have pledged a total of 240bn euros in rescue loans, of which Greece has received around 150bn euros.

In return, Greece has had to impose several rounds of austerity measures and submit its economy to scrutiny.

The European Union's commissioner for economic and monetary affairs, Olli Rehn, said it was crucial that a deal had finally been reached.

"For the eurozone this was a real test of our credibility, of our ability to take decisions on the most challenging of issues.

"And it was a test that we simply could not afford to fail."

However, the Greek radical left opposition party Syriza - who came close to winning elections earlier this year - rejected the deal.

"It's a half-baked compromise, a band-aid on the gaping wound of Greece's debt," said Syriza deputy Dimitris Papadimoulis, who claimed that the German Chancellor Angela Merkel had blocked attempts to cut Greece's debt in half.

'Matter of weeks'

"This is a good deal, but I think a good deal was long overdue for Greece," Gerard Lyons, chief economist of Standard Chartered Bank, told the BBC.

Media playback is unsupported on your device Media caption Constantine Michalos: Greece deal 'vote of confidence'

"The most significant thing is the fact that about 20% of Greek debt has been written off," he said. "The lesson of all crises elsewhere is that unless you start to write down debt you don't really start to make inroads."

However, Mr Lyons cautioned that while the deal mitigated the risk of Greece leaving the euro, it did little to help the Greek economy recover.

"What Greece really needs is to reverse [its] austerity measures," he added. Spending cuts by Athens - a pre-condition for its bailout - have been blamed for significantly worsening a multi-year contraction of the Greek economy.

The sentiment was echoed by Konstantinos Michalos, president of Athens Chamber of Commerce and Industry.

"[The deal] has to be seen as a major vote of confidence to the country," Mr Michalos told the BBC, while affirming that "it's simply extending the lifeline".

Both agreed that Germany's coming parliamentary elections played a role in making the deal possible.

"Six months ago the feeling in Europe generally was that they could sacrifice Greece," said Mr Lyons. "That thinking has now changed, particularly in Germany."

A new sense of caution has descended on Berlin ahead of the elections.

But while that has increased Germany's willingness to head off the broader eurozone crisis that might be sparked by a Greek exit from the single currency, according to Mr Michalos it has also made the German government less willing to grant Greece the greater leniency needed to ensure a stronger economic recovery.

Mr Michalos said the onus was now on his own government to push through structural reforms - such as reducing protections for existing workers - in order to boost competitiveness and confidence in the economy, and achieve positive growth.

"We need to progress with these structural reforms immediately," he said. "It is not a question of years or months. It is a matter of weeks."

The Greek economy is projected by Eurostat to have shrunk by a fifth by the end of this year since the crisis began in 2008.