Updated

Greek stocks rallied to two-year highs on Friday, after the government struck a deal with European creditors that means the country won't face another brush with bankruptcy anytime soon. However, for austerity-weary Greeks the deal does little to lift the pall from years of belt-tightening.

After months of haggling that raised fears of another escalation in Greece's nearly eight-year debt crisis, the 19-country eurozone agreed late Thursday to release a further 8.5 billion euros ($9.5 billion) from its current, third bailout after the Greek government delivered on an array of reforms. Getting the money was becoming increasingly urgent as Greece has a big debt repayment hump next month.

With an eye to the longer term, the eurozone creditors also made clear they are ready to ease the burden of Greece's debt repayments when its bailout program ends next year, possibly by extending repayments by up to 15 years. The International Monetary Fund may also get involved financially, with up to $2 billion, but only if and when it sees the specifics of the debt relief and agrees it can make Greece's debt bearable.

"I think that's really the best agreement we've had for quite a while," said Pierre Moscovici, the top economy official for the European Union, the 28-country bloc that includes the 19 states using the euro.

Though some details remain sketchy, investors breathed were relieved if only because a deal wasn't postponed, as has occurred so many times previously. The main Athens stock index hit a two-year high, later closing up 0.8 percent on the day. Yields on both the two-year and 10-year Greek bonds fell, reflecting diminished investor fears of bankruptcy.

"While the deal might have proved the usual exercise in issue avoidance, the fact is that it's now unlikely that a fresh crisis will emerge in Greece in July," said Simon Derrick, chief markets strategist at BNY Mellon.

Greece's left-led coalition government sought to present the deal as favorably as possible, even though the precise nature of the debt relief has to still be ironed out.

"Yesterday was a good day for Greece, after some time," Prime Minister Alexis Tsipras said in a televised address to the nation. "Now the way is open for us to access markets, for the final end in a year from now of the bailout agreements. The way is opening for our final exit from the crisis."

"We feel justified," he added.

Government spokesman Dimitris Tzanakopoulos said Greece's European creditors had accepted "nearly all the points that the Greek side was asking for."

The spokesman highlighted the creditors' acceptance of a long-standing Greek demand that debt repayments be linked to economic growth, meaning that repayments could be postponed in case the economy enters recession.

Outside the government, the view was less rosy.

Dozens of protesting hospital workers rallied outside the finance ministry building in central Athens, building a fake wall outside the entrance topped with a banner reading: "They have made us drown in debt."

Pictures pinned to the fake wall depicted Tsipras with a tie pinned to his neck. Tsipras doesn't wear a tie, and had once joked that the only time he would do so would be on the day Greece won debt relief.

Tsipras, elected in 2015 on promises to repeal bailout-related budget cuts, has lost popularity after implementing further austerity measures in return for the bailout money and a promise on debt relief.

As part of Thursday's deal, the government committed to deliver primary budget surpluses — that is, a surplus excluding the cost of servicing debt — worth 3.5 percent of Greece's annual gross domestic product until 2022, and 2 percent thereafter each year until 2060. That is a big commitment for Greece, but seems to have been agreed on in principle to show Greece's debt can be sustained with help from creditors.

One reason why Greece's bailout program stalled in recent few months was a disagreement on Greece's long-term debt outlook between the eurozone and the IMF, which contributed financially to Greece's first two bailouts but not the third. Before deciding whether to participate in the latest deal, the IMF still wants more information over the sustainability of Greece's debt in the longer term and the debt relief on offer— its views are still different to the eurozone's.

Christine Lagarde, the IMF's managing director, said enough progress has been made, particularly with regard to focusing more on stimulating Greek economic growth rather than spending cuts, for her to go to the IMF executive board in Washington to propose the approval in principle of a new stand-by arrangement for Greece. The release of IMF funds would be contingent on sufficient debt relief.

She said she hoped this would "give confidence to investors on the prospects for the Greek economy to grow and its people to prosper."

Despite years of spending cuts and tax increases since Greece was first bailed out in 2010, the public sector debt burden stands at about 320 billion euros, or 180 percent of GDP. That's largely because the economy has contracted by around a quarter, meaning a worsening in the relative debt load even as the budget has improved.

An outright cut in Greece's debt is not allowed under euro rules, but the length of time the country has in paying back its debts can be extended, and the interest rates can be cut. More comprehensive details should emerge in the coming months.

____

Pylas contributed from Luxembourg.