"Macedonia will be called the Republic of Northern Macedonia [Severna Makedonija]", Zoran Zaev, the country's prime minister, announced Tuesday.
Greek Prime Minister Alexis Tsipras and Macedonian counterpart Zoran Zaev said the former Yugoslav republic's new name for both domestic and global purposes would be Republic of North Macedonia.
Greece regards "Macedonia" as a term referring only to one of its northern regions and the ancient Kingdom of Macedonia, and insists on the use of another name for its northern neighbor.
He added that Macedonia "cannot and will not be able in the future to claim any connection with the ancient Greek civilisation of Macedonia".
The long-running dispute has centred on Greece's objection to Macedonia's name, which has prompted it to block its neighbour from joining North Atlantic Treaty Organisation and the European Union until it is changed.
In 2016, amid Europe's worst migrant crisis since World War II, Athens accused Skopje of using "excessive force" to push back hundreds of migrants trying to cross into Macedonia to continue their journey to northern Europe.
Macedonian Prime Minister Zoran Zaev said on May 19 that the name of the "Republic of Ilinden Macedonia" could be a possible compromise to be reached between Skopje and Athens in a dispute over the name of the country.
It was admitted to the United Nations as the Former Yugoslav Republic of Macedonia, because of Greece's objection.
On Tuesday the two sides agreed it should be named the "Republic of North Macedonia", ending the lingering and bitter row.
"This historic agreement is testament to many years of patient diplomacy, and to the willingness of these two leaders to solve a dispute which has affected the region for too long", said NATO Secretary General Jens Stoltenberg in a statement. Tusk said: "Thanks to you the impossible is becoming possible", he said.
"This has no precedent in Greek political and constitutional history and an insult of the parliamentary system", he said.
European Union foreign affairs chief Federica Mogherini and commissioner Johannes Hahn issued a joint statement 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 dispute has poisoned relations between the two neighbors since Macedonia's independence from Yugoslavia in 1991.
The main opposition party in Macedonia, the conservative VMRO-DPMNE, accused Zaev of "capitulating" to Greece.
Greek opponents of the deal say it would not go far enough.
Greece also demanded that Macedonia drops from its flag the rayed sun of Vergina, which it claimed was an ancient Greek symbol, as well as certain articles from its constitution.