Macedonia, which was created when Yugoslavia broke up, was invited to join the alliance in 2008, but its membership was vetoed by Greece, which already has its own province named Macedonia.
Athens claimed that the name made it sound like Macedonia the country has its eyes set on annexing Macedonia the province — or at the least was appropriating Greece's historical heritage.
Macedonia's parliament has approved a constitutional amendment to change the country's name to the Republic of North Macedonia, reports BBC News.
Prime Minister Zoran Zaev narrowly secured the two-thirds majority needed in the historic vote amid a boycott by opposition nationalists.
Protesters outside parliament denounced what they called an act of treason.
Greek Prime Minister Alexis Tsipras has congratulated his counterpart Zoran Zaev of the Former Yugoslav Republic of Macedonia on the outcome of a parliament vote on constitutional changes related to the name agreement with Greece, his press office said in a statement.
The deal clears the way for FYROM to join NATO and potentially the European Union.
Prime Minister Zoran Zaev of the Former Yugoslav Republic of Macedonia (FYROM) was struggling Thursday to get the required number of lawmakers to finalize constitutional changes that will rename the country "Republic of North Macedonia" and allow its NATO accession under a deal with neighboring Greece.