Greece will get loans of more than 130bn euros (£110bn; $170bn) and have about 107bn of its debt written off.
In return, it must slash its debt from 160% to 120.5% of GDP within eight years and accept a permanent EU economic monitoring mission.
The country needs the funds to avoid bankruptcy on 20 March, when maturing loans must be repaid.
The euro immediately rose on reports of the deal, which was announced early on Tuesday, after 13 hours of talks.
But a report by international experts obtained by Reuters news agency and the Financial Times warned Greece would need more help if it was to meet its debt reduction target.