Greek Prime Minister Alexis Tsipras has survived a no-confidence vote over the deal his government made to settle a name dispute with Macedonia.
It was tabled by the country’s main opposition party, New Democracy, but was rejected by a margin of 153-127.
The result paves the way for an historic signing ceremony on Sunday.
Mr Tsipras and his Macedonian counterpart Zoran Zaev have agreed that Greece’s neighbour will be renamed the Republic of North Macedonia.
The aim of the deal was to distinguish it from an identically-named Greek province.
The name has been a subject of contention for more than two decades since the break-up of the former Yugoslavia, with Athens arguing that by using the name Macedonia the country was implying it had a claim to the Greek region.
But opposition figures in Greece argue that Mr Tsipras has made too many concessions in the deal.
On Saturday, protesters angry with the government briefly clashed with police on the steps of the parliament building.
Following the vote, the foreign ministers from both countries are expected to meet on the border for a ceremony in which they will sign the agreement.
Greek Foreign Minister Nikos Kotzias and Macedonia’s Nikola Dimitrov will sign the pact on Sunday and both prime ministers will be present.
But there is still some way to go before the name change becomes official.
The agreement will have to overcome a few obstacles before it goes through. Macedonia’s parliament will first need to back the deal. That would be followed by a referendum in September or October.
If voters there support it, the government would have to change the constitution which is a key Greek demand.
Things have been complicated further as Macedonia’s President Gjorge Ivanov is refusing to sign the agreement. He has the power to veto the deal – but not indefinitely.
If he refuses to sign it, it will be sent back to parliament for a second vote. If it passes again, President Ivanov would then be obliged to approve the legislation.
The deal will finally have to be ratified by the Greek parliament, a process which may also not be straightforward.