A total of 153 MPs in the 300-seat Greek parliament approved the name Republic of North Macedonia despite widespread public opposition. The change had already been ratified by Macedonian lawmakers on January 11.
Since 1991, Athens has objected to its neighbor being called Macedonia because Greece has a northern province of the same name. In ancient times, it was the cradle of Alexander the Great's empire, a source of intense pride for Greeks, Presstv Reported.
To make the UN-sponsored agreement final, Greece must now ratify a protocol approving Macedonia's membership of the Western military alliance NATO. This is expected to take place next month.
"We warmly welcome the next crucial step in the ratification... taken with today's vote by the Hellenic Parliament," EU President Jean-Claude Juncker said in a joint statement with foreign policy chief Federica Mogherini and enlargement commissioner Johannes Hahn.
"Both countries have seized this unique opportunity, which sets an example of reconciliation for Europe as a whole and will give a further boost to the European perspective of the region," the EU officials said.
"Today is a historic day," Greek Prime Minister Alexis Tsipras, who forged a close relationship with his North Macedonia counterpart, Zoran Zaev, in drafting the agreement last year, said in a tweet.
"Today we write a new page for the Balkans. The hatred of nationalism, dispute and conflict will be replaced by friendship, peace and cooperation," Tsipras said on his Twitter page.
European Council President Donald Tusk said the two countries had achieved "mission impossible."
'Congratulations, my friend'
"Congratulations my friend" Alexis Tsipras, Zaev said on Twitter. "Together with our peoples we reached a historic victory."
"Long live the Prespa Agreement! For eternal peace and progress of the Balkans and in Europe!"
Germany — whose chancellor Angela Merkel had personally expressed gratitude to Tsipras during a recent visit to Athens — also welcomed the news as a "victory for diplomacy."
Protests have been held in both countries against the agreement — some of them violent — and lawmakers in Greece have reported threats and arson attacks against their homes.
A few dozen protesters gathered outside the Greek parliament on Friday.
A poll released by SKAI TV on Thursday night found that 62 percent of respondents opposed the deal, with 27 percent in favor.
A week earlier, another poll in Proto Thema weekly had found 66 percent in opposition.
Anti-Tsipras daily Ta Nea said on Friday that the deal was the result of a "painful compromise" and was full of "pitfalls."
In addition to normalizing relations between the two countries, implementation of the agreement will open the door for Macedonia to join the European Union and NATO, hitherto blocked by Athens' veto.
But in Greece, its neighbor’s name continues to fuel controversy in politics and society, ahead of parliamentary elections scheduled for October.
Critics say the agreement — which drops Greece's objections to an official Macedonian language and identity — opens the way for possible cultural usurpation and trade disputes.
Main opposition leader Kyriakos Mitsotakis of the conservative New Democracy Party said the agreement "creates new problems" and "awakens nationalism."
"Your foreign policy is superficial and ignorant... you should be ashamed," he told the government.
But Tsipras told parliament during a two-day debate on the deal, "We never had a Macedonian language. Alexander the Great spoke Greek."
"Are you afraid of a state that does not even have two percent of our (military) capability and not even six percent of our economic output?" former foreign minister Nikos Kotzias, a signatory to the agreement, asked parliament on Thursday.
On Sunday, clashes between police and masked protesters left 40 people injured as tens of thousands demonstrated in Athens against the name change.
The government blamed far-right extremists and the neo-Nazi Golden Dawn Party for the violence.