An historic deal has been signed aimed at resolving a long-running name dispute between Greece and FYR Macedonia.

The two countries have agreed to rename the Former Yugoslav Republic of Macedonia to the Republic of North Macedonia.

But the deal still has to be ratified by both countries' parliaments, while in FYR Macedonia it will be the subject of a referendum.

If it goes through it could pave the way for FYR Macedonia to join the EU and NATO, something Greece has previously blocked because of the name dispute.

"We have a historic responsibility that this deal is not held in abeyance, and I am confident that we will manage it," Greek Prime Minister Alexis Tsipras said as he and his Macedonian counterpart Zoran Zaev received a standing ovation from guests at the lakeside ceremony.

Tsipras survived a no-confidence vote mounted by Greece's opposition in parliament on Saturday, but the depth of public emotion against the deal is strong.

Up to 70 percent of Greeks object to the compromise, an opinion poll by the Proto Thema newspaper showed on Saturday. In Psarades, the tiny lakeside community where the deal was signed, the village church bell tolled in mourning, draped in a Greek flag.

More on this subject