'There is an agreement. "There is no way back", Zaev told a news conference.
In a nutshell, Greek people felt like the name belonged to them because it ties in with the country's heritage and the Macedon Kingdom - the king of which was Alexander the Great, who you'll have heard of.
It was only with the adoption of a provisional name - the Former Yugoslav Republic of Macedonia (FYROM) - that the country was finally admitted into the United Nations in 1993.
In Skopje, meanwhile, Macedonian president Gjorge Ivanov said earlier in the day that he remained opposed to writing the new name into the constitution, a move meant to show the change is permanent and binding for domestic and worldwide use.More news: Beyond Good & Evil 2 teases Jade as the villain
Greece's Macedonia includes the major port city of Thessaloniki, and tensions have existed between Greece and its neighbor for over two decades, following the breakup of the former Yugoslavia. Thanks to you the impossible is becoming possible. I believe in the democracy of the internet and want to keep this site and its enriching content free for everyone. The Greek parliament will also have to agree to the proposal.
"I am convinced that the referendum on the new name will be successful and that most citizens will say yes", said the Macedonian PM.
European Union foreign affairs chief Federica Mogherini and commissioner Johannes Hahn issued a joint statement also congratulating the two prime ministers "in reaching this historic agreement between their countries, which contributes to the transformation of the entire region of South-East Europe".
"The acceptance of the Macedonian language and nationality is an unacceptable national retreat", he said.
Both governments have faced criticism ahead of the compromise and on Tuesday Macedonia's President Gjorge Ivanov signalled his concern.More news: Can Neymar help Brazil forget their 2014 disaster?
He is close to the nationalist VMRO-DPMNE party which was defeated by Zaev in elections past year.
Greek Prime Minister Alexis Tsipras addressed the nation in a 5-minute televised address to announce the deal with his counterpart, Prime Minister Zoran Zaev.
"Maybe what has the most historic gravity and value for Greece is that according to this accord. our northern neighbours don't have, and can not assert, any link to the ancient Greek culture of Macedonia", Tsipras said on Tuesday, in remarks that might sting a Macedonian nationalist.
Skopje hopes to secure a date to begin accession talks at an European Union summit in late June, and an invitation to join North Atlantic Treaty Organisation in mid-July.
"By solving the name question, we're becoming a member of North Atlantic Treaty Organisation", he added. "And it will help to consolidate peace and stability across the wider Western Balkans".More news: Canada condemns US attack on Trudeau, country simmers
A spokesman for U.N. Secretary-General Antonio Guterres said the settlement will have "positive repercussions" in Europe and beyond, and hopes it will inspire others to negotiate deals to end other "protracted conflicts".