Macedonia signed accession papers with NATO on Wednesday, a key step on the way to joining the alliance after resolving a long-running name row with Greece.
The Macedonian Foreign Minister Nikola Dimitrov and representatives of all current NATO members signed the protocol at alliance headquarters in Brussels.
NATO Secretary General Jens Stoltenberg said it was a "historic day" which will lead to Macedonia becoming the 30th alliance member once the deal has been ratified by all the other capitals.
"All #NATO Allies have signed the Accession Protocol ... which will bring more security & prosperity to the whole region. I look forward to the day when 30 flags will fly outside NATO HQ," Stoltenberg tweeted.
The agreement last month with Greece to change the name of the former Yugoslav republic to the Republic of North Macedonia ended one of the world's longest diplomatic disputes and paved the way for Skopje to join NATO and the European Union.
Macedonian Prime Minister Zoran Zaev said it was a "great, historic day for all our citizens".
"Today the largest security alliance in the world, NATO, has welcomed us," he wrote on Facebook and Twitter. "We have provided lasting stability for our country."