ATHENS—Greece and Macedonia agreed to rename the Balkan country “North Macedonia” in a breakthrough that could end a bitter 27-year-old dispute and pave the way for expansion of the North Atlantic Treaty Organization and the European Union.

The deal, reached on Tuesday in a phone call between Greek Prime Minister Alexis Tsipras and his Macedonian counterpart Zoran Zaev, calls for Greece to lift its longstanding veto over NATO and EU membership talks with its neighbor.

The...