Greece on Friday ratified a landmark accord that changes the name of neighboring Macedonia, ending a decades-old dispute with its neighbor and opening the way for the ex-Yugoslav republic to join the European Union and NATO.

Prime Minister Alexis Tsipras, who hammered out the deal with his Macedonian counterpart last year, secured enough votes to scrape the vote through a deeply divided Parliament on the third day of a debate fraught with emotion, anger and cries of betrayal.

The settlement seeks to end a 28-year old dispute between Athens and Skopje over the use of the term "Macedonia" by renaming the tiny Balkan state "Republic of North Macedonia" to differentiate it from Greece's northern province of Macedonia.