The two countries agreed that the new name would be used both internationally and bilaterally, so that even the 140 or more countries that recognize the name Macedonia will also have to adopt North Macedonia.
They also agreed that the English name could be used as well as the Slavic term.
The two sides had earlier dropped a number of alternatives, including Gorna Makedonija (Upper Macedonia), Nova Makedonija (New Macedonia) and Ilinden Macedonia.
The name Macedonia already belongs to a northern region of Greece that includes the country’s second city Thessaloniki. By adopting the same identity in 1991, the new Slavic nation infuriated many Greeks, who suspected their northern neighbor of territorial ambitions.
The new Macedonians did not help matters when they named the main airport in the capital, Skopje, after Ancient Greek hero Alexander the Great, as well as a key motorway running from the Serbian to the Greek border.
During the 4th Century BC, the Macedonia of Alexander and his father Philip II before him ruled all of Greece and much beyond it.
When the Ottomans were driven out of the broad region known as Macedonia during the Balkan Wars of 1912-13, it was split up, mainly between Greece and Serbia, but a small part went to Bulgaria.
In World War Two, Greek and Yugoslav Macedonia were occupied by Bulgaria, an ally of Nazi Germany and Italy. Communists from both Yugoslavia and Bulgaria played a part in the Greek civil war that followed, so memories are still raw.
When Yugoslavia broke up, Greece would only accept the new country as “Former Yugoslav Republic of Macedonia (FYROM)” at the UN, even though much of the world came to recognize it as Macedonia.