The International Monetary Fund has pledged to work with Greece and its European creditors to solve the country’s financial crisis after Monday’s bailout agreement.

The conditional agreement allows Greece to temporarily avert the prospect of abandoning the euro and the global financial chaos that would cause.

European Council President Donald Tusk tweeted shortly before 9 a.m. local time Monday that the so-called EuroSummit had "unanimously reached agreement" on a financial aid program that included what Tusk called "serious reforms" and "financial support" for the beleaguered Athens government. At a news conference later Monday, Tusk jokingly referred to the deal as an "a-Greek-ment."

The deal calls for Greece, already reeling from harsh austerity measures, to cut back even further in exchange for more loans without which its financial system would surely collapse. It still requires approval from Greece's parliament by the end of Wednesday.

"We managed to avoid the most extreme measures," Greek Prime Minister Alexis Tsipras said. "Greece will fight to return to growth and to reclaim its lost sovereignty."

More On This...

IMF spokesman Gerry Rice said the Fund's managing director, Christine Lagarde, had briefed the global lender's board on the outcome of weekend talks, Reuters reported.

``The IMF stands ready to work with the Greek authorities and the European partners to help move this important effort forward,'' Rice said in a brief statement.

News of the deal caused the Euro to jump significantly in early morning currency trading on the European stock markets. U.S. stocks opened higher after news of the agreement, and European and Asian markets also rose Monday.

The agreement came after months of often bitter negotiations and a summit that stretched from Sunday afternoon well into Monday morning. Tsipras had been holding out for a better deal to sell to his reluctant legislature in Athens this week, even as financial collapse grew closer by the day.

Tsipras also had to overcome the fundamental mistrust of many of his allies among the 18 other countries that use the euro. Just a week earlier, at the Prime Minister's urging, Greeks had voted in a referendum to reject many of the measures he agreed to Monday, and the deal forced Tsipras to renege on many of his election promises.

A breakthrough came in a meeting between Tsipras, Hollande, German Chancellor Angela Merkel and Tusk, after the threat of expulsion from the euro put intense pressure on Tsipras to swallow politically unpalatable austerity measures in exchange for the country's third bailout in five years.

"We took the responsibility of the decision to be able to avert the harshest outcome," Tsipras said. "We managed to avert the demand to transfer Greek assets abroad, to avert the collapse of the banking system."

French President Francois Hollande celebrated Greece's continued membership in the euro. For the eurozone to have lost Greece, Hollande said, would have been to lose "the heart of our civilization."

The deal includes commitments from Tsipras to push a drastic austerity program including pension, market and privatization reforms through parliament by Wednesday. In return, the other eurozone leaders committed to start talks on a new bailout program that should stave off the imminent collapse of the Greek financial system.

Merkel said that along with the deal, "trust needs to be rebuilt."

"Greece has a chance to return to the path of growth," she said, but "it will be a long road."

"The Greeks have to show they're credible, show that they mean it," said Jeroen Dijsselbloem, president of the eurogroup of eurozone finance ministers and a longtime critic of the Tsipras government.

The terms of the deal will be painful both for Greeks and their radical left-led government, which since its election in January had vowed to stand up to the creditors and reject the budget cuts they have been demanding.

But many seemed relieved that the country was not facing a messy exit from the euro. Kostas Lambos, a retireer in Athens, said things would be "difficult in the beginning" but people had to understand the severity of the situation.

"This was a necessary step for the country to emerge from the dead ends that had been created in the last few years," Lambos said.

Greece's banks, which have been shut for two weeks, were still closed Monday and limits remained on cash withdrawals.

When they will be able to reopen will depend on when the European Central Bank decides to increase emergency credit to Greek banks. The ECB on Monday decided to not increase that credit. Analysts say it may be waiting for the Greek parliament to approve a first batch of reforms to secure the country's bailout.

A Cypriot official said the creditors would look into bridge financing for Greece later Monday, suggesting that the political decision could pave the way for the European Central Bank to extend emergency liquidity assistance to Greek banks. Without it, they risk running out of cash this week. The official spoke only on condition of anonymity because he was not authorized to discuss the deal publicly.

If the talks had failed, Greece could have faced bankruptcy and a possible exit from the euro, the European single currency that the country has been a part of since 2002. No country has ever left the joint currency, which launched in 1999, and there is no mechanism in place to do so.

Greece had requested a three-year, 53.5 billion-euro ($59.5 billion) financial package, but that number grew larger by the tens of billions as the negotiations dragged on and the leaders calculated how much Greece will need to stay solvent.

Greece has received two previous bailouts, totaling 240 billion euros ($268 billion), in return for deep spending cuts, tax increases and reforms from successive governments. Although the country's annual budget deficit has come down dramatically, Greece's debt burden has increased as the economy has shrunk by a quarter.

The Greek government has made getting some form of debt relief a priority and hopes that a comprehensive solution will involve European creditors at least agreeing to delayed repayments or lower interest rates.

Greek debt stands at around 320 billion euros ($357 billion) -- a staggering 180 percent or so of the country's annual gross domestic product. Few economists think that debt will ever be fully repaid. Last week, the IMF said Greece's debt will need to be restructured.

The Associated Press contributed to this report.