Greece argues that the term "Macedonia" implies a claim on the territory and ancient heritage of its own northern province of the same name - the birthplace of ancient warrior king Alexander the Great.
For decades Greece and the former Yugoslav Republic of Macedonia (FYROM) had a contentious relationship over the name.
But Mr Ivanov says a shot at membership would not justify signing a "bad agreement".
However, previous administrations in Macedonia's capital, Skopje, have resisted demands to change or modify the name.
"Today is a hard day for the Republic of Macedonia".
Are you happy both sides have resolved the issue?
The Macedonian president, originally backed by the right-wing VMRO-DPMNE party, has had a bumpy relationship with Zaev and his Social Democratic Union of Macedonia.
After that, Macedonia's Parliament would vote on it, and if it is approved, Mr Ivanov's signature would be needed.
Don’t Be Afraid to Talk With Someone
For readers outside the US , visit Suicide.org or Befrienders Worldwide for global resources you can use to find help. After Marilyn Monroe died in August 1962, the cause listed as probable suicide, the nation mourned - publicly.
"In other words, if the constitutional amendment is not successfully completed, then the invitation to join North Atlantic Treaty Organisation will be automatically rescinded and the accession talks with the European Union will not start", he said.
The name dispute has roused strong nationalist sentiments and poisoned the two countries' relations since the Balkan country declared independence from Yugoslavia in 1991. If the result is negative, early parliamentary elections will be called.
National Macedonian flags flutter in front of the government building in Skopje, Macedonia June 12, 2018.
Greek Prime Minister Alexis Tsipras also faces opposition at home.
Tsipras insisted the Macedonian government needed to get parliamentary approval otherwise "NATO's invitation is canceled and negotiations with the European Union will not move".
Donald Tusk, president of the European Council, tweeted his congratulations to the two leaders: "I am keeping my fingers crossed".
Centre-left daily Ta Nea newspaper said that, while the historian of the future would have the luxury of time to assess the deal, "until then one must keep in mind that there are no compromises without concessions".
The deal, announced by the leftist governments in Athens and Skopje on Tuesday, envisages Macedonia changing its name to the Republic of North Macedonia, subject to approval in a referendum in Macedonia that could be held later this year.
Black Ops 3 is a bonus free game on PlayStation Plus
That means have a good few months to play the last Black Ops game over to get up to speed before the next installment. Announced today was the Black Ops pass , which Activision says "represents a new approach to post-launch content".
Prime Minister Tsipras has also faced heavy criticism from political opponents.
"We should serve the citizens and that is why we need to improve Macedonia in all aspects".
But Macedonia clearly liked the name, too, meaning that there's been a massive stand-off for nearly 30 years, which has seen many protests and conflict. President Gjorge Ivanov, supported by Gruevski's party VMRO-DPMNE, said any deal shouldn't involve a constitutional revision.
This year there have been several protests against an agreement in Skopje, as well as in Athens and Greece's second city of Thessaloniki in the north.
Greece and Macedonia have reached an agreement on the new name of the later after a dispute that lasted 27 years.
As it happens, Greece also has a region called Macedonia. "And it will help to consolidate peace and stability across the wider Western Balkans", Stoltenberg said.
New Democracy leader Kyriakos Mitsotakis called the deal "deeply problematic" because he said the majority of Greeks were against it and Tsipras lacked the authority to sign it.
Furious Scots walk out of United Kingdom parliament over Brexit
SNP leader Nicola Sturgeon has said she was "right behind" Blackford and accused Westminster of treating Scotland with "contempt". Such a complex endeavour is bound to complicate the agenda of Prime Minister Theresa May as she tries to negotiate Brexit .