Parliamentary speaker Talad Xhaferi said 81 MPs had voted in favour of the name change in the 120-seat chamber, securing the required two-thirds majority.
The name change will only be effective once it is also agreed by the Greek parliament.
Ahead of the vote, Macedonian Prime Minister Zoran Zaev had emphasised the historic importance of the decision.
"Without the accord with Greece, there will be neither NATO nor EU" membership, Zaev said.
"I changed my opinion on the name issue in the name of progress and at the cost of my political career," he added.
Athens has promised to lift its veto on Skopje's attempts to join NATO and the European Union on the condition Macedonia changes its name.
Greece has blocked the path to those international organisations since Macedonia broke away from the former Yugoslavia in 1991 because, it had said, the name Macedonia should apply solely to its own northern province.
For the Greeks, Macedonia evokes national pride as the cradle of Alexander the Great's ancient empire.
The Friday vote brought an end to months of political bickering in Macedonia that included a controversial consultative referendum in September and a long parliamentary battle.
Officials of the main opposition conservative VMRO-DPMNE party, who refused to take part in the parliamentary debate, claimed the name change was national treason.
However several opposition MPs broke ranks and voted for the change, alongside the ruling Social Democratic party and their junior coalition partners from the ethnic Albanian minority.
Notably the outcome was enabled thanks to four MPs who received an amnesty for their alleged roles in the violent storming of parliament in April 2017.
That prompted VMRO-DPMNE leaders to denounce "bribes and threats" used by Zaev to reach the necessary majority.
The vote is a political triumph for the Social Democratic leader who analysts say was weakened by the low turnout in the September referendum.
Macedonia's rightwing president, Gjorge Ivanov, has been a vocal opponent of the proposed name change and continues to speak out against it.
But the Macedonian constitution stipulates that as the measure was passed by a two-thirds majority, the president has no choice but to sign it into law.
Zaev, who came to power in May 2017, will now look to Greek Prime Minister Alexis Tsipras to uphold his end of the deal, which was brokered last year.
"The prime minister congratulated Mr Zaev on the successful conclusion of the process to revise the constitution of the former Yugoslav republic of Macedonia," Tsipras' office said in a statement, after the vote.
Tsipras has said he sees the Macedonia deal as "one of his greatest legacies" as premier, second only to leading Greece out of the bailout era.
He, however, also only has a fragile parliamentary majority, with 153 deputies in the 300-seat Greek parliament.
Further complicating matters, Greek coalition partner Defence Minister Panos Kammenos, the leader of a smaller party, opposes the deal and has threatened to resign.