European leaders
European leaders hold a late night summit in BrusselsReuters

European leaders said Greece has agreed to finish a new reform plan within days as it races to avoid heading into bankruptcy.

The breakthrough came after late night talks between Greek Prime Minister Alexis Tsipras, the leaders of Germany, France and EU institutions.

The late-night summit lasted for more than three hours and Tsipras left saying he felt "more optimistic" after the Brussels talks.

Greece will receive much-needed funding once it submits a detailed list of economic reforms to the so-called Eurogroup, the circle of eurozone finance ministers.

"What was discussed was that once the reforms are submitted, and in a detailed manner, to the Eurogroup when that happens....then the funding will be unlocked towards the Greek economy," a Greek government spokesman said on Friday.

Greece has previously submitted a list of planned reforms to the Eurogroup but these were criticised for being too vague. European leaders will expect the new list to provide much more detail before they agree to release the funds.

Greece is thought to have enough funding to stave off bankruptcy until sometime in April.