Macedonia's prime minister has pledged to press on with a vote in parliament to change the country's name to resolve a decades-old dispute with Greece, despite failing to secure the 50 percent turnout at a referendum required to make it valid.

The proposed name change is part of an agreement reached in June by pro-Western Prime Minister Zoran Zaev with Greece to resolve the dispute over the country's name, which had prevented Macedonia from joining NATO or the EU.

With 85% of votes counted, official turnout was just 36%, and election officials made clear there was no chance the threshold would be cleared.

"On this referendum, it is clear that the decision has not been made," election commission head Oliver Derkoski told reporters.

The people who did vote overwhelmingly backed the name change - more than 90% voted yes with 63% of polling stations reporting.

But that had never been in doubt, since opponents of the change had urged followers not to vote, rather than vote no.

"It is clear that the agreement with Greece has not received the green light from the people," main nationalist opposition VMRO-DPMNE party leader Hristiajn Mickoski told journalists.

Read more:

The referendum was itself not legally binding, but policy makers had pledged to abide by it, and the failure to reach the turnout threshold means opponents can now freely vote against the deal.

The nationalist opposition holds 49 seats in the 120-seat parliament, enough to block the two-thirds majority required to change the constitution.

In an address, Mr Zaev made no mention of the turnout but said the votes of those who had backed the change must be respected.

He pledged to hold a vote in parliament on the name change, and call an early election if lawmakers failed to enact it.

"I am determined to take Macedonia into the European Union and NATO," Mr Zaev said.

He spoke again later in the evening, along similar lines: "It is time to support European Macedonia."

The Greek foreign ministry said it respected the will of the people of the country, which it refers to by the provisional name Former Yugoslav Republic of Macedonia.

The referendum passed judgment on the agreement with Greece reached in June, under which Macedonia would change its name to the Republic of North Macedonia.

Greece, which has its own province called Macedonia, maintains that its northern neighbour's name represents a claim on its territory.

Because of the dispute, Greece has vetoed Macedonia's entrance into NATO and the EU.

While polls have long showed that a vast majority of Macedonians want to join NATO and the EU, nationalist opponents of the name change argued that it undermined the ethnic identity of Macedonia's Slavic majority.

The question on the referendum ballot read: "Are you for NATO and EU membership with acceptance of the agreement with Greece".

Supporters of the name change argued that it was a price worth paying to pursue admission into bodies such as the EU and NATO.