People wave flags in front of the parliament building in Skopje, Macedonia, on June 13 during a protest against the proposed new name of the country. (Robert Atanasovski/AFP/Getty Images)

ON TUESDAY, while the attention of the world was focused on the Singapore summit, two other countries set aside their differences and took a significant step toward ending a decades-long impasse. For 27 years, Macedonia and Greece have been locked in dispute over Macedonia’s name. A new deal between the administrations of Greek Prime Minister Alexis Tsipras and Macedonian Prime Minister Zoran Zaev, which will have Macedonia formally change its name to the Republic of North Macedonia, offers a chance for the countries to improve bilateral relations and regional peace.

The name change may seem minor, but the agreement is in fact a significant breakthrough in a diplomatic stalemate that had threatened Macedonia’s NATO and European Union ambitions. Athens, which had long felt that the name “Macedonia” implied territorial ambitions over the Greek region of the same name, has been at loggerheads with Macedonia since its independence from Yugoslavia in 1991. This tension culminated in Greece blocking Macedonia’s NATO membership in 2008 and E.U. accession talks a year later. More recently, disagreement over the naming of a Macedonian airport and highway for Alexander the Great led to accusations of cultural appropriation and reignited the feud over national identity.

In this context, the name-change agreement is a credit to both leaders, who persisted with negotiations despite domestic opposition and the burden of so much history. Both nations stand to gain from the deal. Macedonia would emerge from isolation and have the opportunity to pursue European integration and NATO membership. Greece would benefit from the resolution of the territorial dispute and the elimination of a recurring national headache. Crucially, the deal could also bring greater stability to the region at large: Not only would it reduce tensions between the two neighbors, but also Macedonia’s proposed admittance to the E.U. and NATO would limit Russian interference in the western Balkans.

The agreement is a testament to the good-faith efforts of both governments and the years of United Nations-mediated negotiations that have led to this moment — but the battle for this compromise is far from over. For the name change to become official, it will have to be approved by the Greek and Macedonian parliaments and by the Macedonian public in a referendum. These are weighty obstacles, particularly in Greece, where the opposition has filed a no-confidence motion against Mr. Tsipras’s government over the deal. Macedonia’s nationalist opposition has likewise voiced displeasure. Troublingly, Macedonian President Gjorge Ivanov has refused to sign the deal, which means it will have to pass the parliament twice before he is obligated to sign it.

In the months ahead, international stakeholders and policymakers should support the peacemakers in Macedonia and Greece as they push for parliamentary ratification and a fair referendum process. If this long-awaited compromise is sacrificed to nationalism and political convenience, it would be a sad day for diplomacy — and a missed opportunity that both countries might soon regret.