The prime ministers of Greece and Macedonia say they have agreed on "Republic of Northern Macedonia" as the new name for the Balkan country, ending a bitter 27-year dispute that had prevented the former Yugoslav republic from joining international institutions such as NATO, ABC News reported.

Greece's Alexis Tsipras and Macedonia's Zoran Zaev made the announcements shortly after speaking by phone.

The new name — which in Macedonian is Severna Makedonija — will be used both domestically and internationally, while Macedonia will also amend its constitution as part of the deal.

Greece had long demanded that Macedonia change or modify its name to avoid any claim to the territory and ancient heritage of Greece's northern region of Macedonia — birthplace of ancient warrior king Alexander the Great.

"There is no way back," Mr Zaev told a news conference as he explained the decision.

"We have been solving a two-and-a-half decade dispute … that has been drowning the country," he said, adding that the deal "will strengthen the Macedonian identity".