Macedonia’s parliament passed an amendment to the constitution on Friday to rename the country Republic of North Macedonia in line with an agreement with Greece to put an end to a 27-year-old dispute.

The two countries struck the deal on the new name in June, but Macedonia will start using it only after the parliament in Athens also ratifies the agreement.

Eighty-one deputies in the 120-seat parliament voted in favour. Representatives of the opposition VMRO-DPMNE, who opposed the agreement with Greece, boycotted the vote.

“A new historical chapter in our statehood has been written this evening,” the Macedonian government said in a statement. “It makes absolutely plausible two of our biggest state interests - membership in Nato and EU.”

The Greek prime minister, Alexis Tsipras, called his Macedonian counterpart, Zoran Zaev, to congratulate him, his office said in a written statement.

Greece blocked its neighbour’s aspirations to EU and Nato membership over the use of Macedonia which, it said, implied territorial claims to a Greek province of the same name.

The implementation of the agreement, named after the bordering town of Prespa where it was signed, is intended to end the dispute.

The Nato secretary general, Jens Stoltenberg, and the EU commissioner in charge of enlargement, Johannes Hahn, hailed the vote.

“Nato strongly supports the full implementation of the agreement, which is an important contribution to a stable and prosperous region,” Stoltenberg wrote on his Twitter account.

“My sincerest congratulations to political actors and citizens of the hopefully soon to be North Macedonia on parliament’s vote on the constitutional changes,” Hahn tweeted. “(I) hope that this historic decision creates a positive dynamic for reconciliation in the whole western Balkan region.”

Campaigners against the name change protest in front of the parliament building in Skopje. Photograph: Ognen Teofilovski/Reuters

Several hundred people have protested against the deal in front of the parliament building in Skopje over the past three days. Macedonian opposition parties and nationalists say changing the name of the country and national symbols is too high price to pay for Nato accession.

The opposition VMRO-DPMNE party has asked for an early election. “The vote on constitutional amendments that changed the name, identity, history and culture was done against the constitution. It was illegal, violent and done in a criminal way,” its leader, Hristijan Mickoski, told journalists after the vote.