The former Yugoslav Republic of Macedonia will now be known as the "Republic of North Macedonia" but only if both parliaments and a Macedonian referendum ratify the deal.
Greece and the former Yugoslav Republic of Macedonia set aside decades of dispute on Sunday as they agreed on a new name for the Balkan state, potentially paving the way for Skopje's admission to the EU and NATO.
The foreign ministers of Greece and Macedonia signed an accord to rename it the "Republic of North Macedonia," despite a storm of protest over a deal seen as a national sellout by some on both sides.
In the idyllic setting of Prespes, a lake region which borders Greece, Macedonia and Albania, officials from the two countries embraced, shook hands and signed the deal in the presence of European and United Nations officials.
But in Pisoderi village, 15 kilometres away from the signing ceremony, police were clashing with Greek hardliners.
The agreement still requires the approval of both parliaments and a referendum in Macedonia. That approval is far from assured, as it faces stiff opposition from the Greek
public, and Macedonia's president has vowed to block the deal.
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.
Under the deal, Greece will lift its objections to the renamed nation joining the EU and NATO.
Greece has been in dispute with Macedonia since 1991 over the former Yugoslav republic's name, arguing it could imply territorial claims over the Greek province of Macedonia and an
appropriation of ancient Greek culture and civilisation.