"Our neighbours will be called the Republic of Northern Macedonia," Greek Prime Minister Alexis Tsipras said Tuesday, after two days of telephone talks with Macedonian counterpart Zoran Zaev that capped months of frensied diplomatic activity aimed at finally settling the row.
Tsipras said that the crucial point of the compromise was to differentiate the neighbouring country from the ancient and modern-day Greek province of Macedonia with the geographic qualifier "Northern."
Ever since Macedonia emerged as a sovereign state from the disintegrating former Yugoslavia in 1991, Athens has been accusing it of an attempt to steal the Hellenic legacy of the Greek province with the same name.
Greece blocked Macedonia from joining NATO in 2008 because of the dispute. It has also been a stumbling block in Skopje's ambition to join the European Union.
Zaev, who appeared in a televised news conference in Skopje at the same time as Tsipras spoke in Athens, described the deal as a "historic agreement for centuries."
"We believe Macedonia will receive an invitation to become the 30th member of NATO at its summit on July 12," Zaev added.
The two prime ministers are set to sign their agreement in the coming days. Local media in both countries said that the ceremony would take place on Lake Prespa, on the shared border.
The agreement will go to a referendum in Macedonia in the autumn and, if it clears that hurdle, it will lead to the ratification in Skopje, Zaev said.
Once Macedonia ratifies the constitutional changes, Greece will give the green light for Macedonia's membership in NATO, he explained.
The European Union and NATO immediately welcomed the agreement, signalling that the deal will allow the country to take steps towards joining both.
EU foreign policy chief Federica Mogherini noted that the EU perspective in the Western Balkans region was "a crucial incentive for this agreement, in the spirit of good neighbourly cooperation."
She called on EU countries to approve opening accession talks with Macedonia.
But Zaev warned that "if either of the sides fails to meet its commitment and ratify the agreements, it will fail," he said. "Then we start from square one."
Square one was in 1995, when the United Nations began mediating in the dispute. The talks, handled by the US diplomat Matthew Nimetz throughout, were however fruitless.
"I have no doubt this agreement will lead to a period of enhanced relations between the two neighbouring countries and especially between their people," Nimetz said in a statement.
The breakthrough became possible after the Social Democrat Zaev one year ago ended a decade-long reign by hardline nationalists in Skopje and began making conciliatory gestures toward Greece, which eventually rebooted the talks at the start of the year.