SKOPJE, Macedonia - A referendum on changing Macedonia's name as part of a deal that would pave the way for NATO membership won overwhelming support Sunday, but low voter turnout highlighted the hurdles that still remain for the Balkan country to join the alliance.

Prime Minister Zoran Zaev had hoped for a strong show of support in the referendum on whether to accept a June deal with Greece changing the country's name to North Macedonia. That would help him with the next step of winning parliamentary support for the required constitutional amendments.

Results from more than 97 per cent of polling stations showed 91.3 per cent of voters approving the deal. But turnout stood at just 36.8 per cent, a far cry from the massive support the government had hoped for.

Opponents to the name change had called for a boycott of the vote and celebrated in the street outside Parliament when turnout figures were announced, chanting slogans and waving flags.

Nevertheless, Zaev declared the vote a success.

“The people made a great choice and said 'yes' to our future. It is time for lawmakers to follow the voice of the people and to provide support,” he said. “There will be no better agreement with Greece, nor an alternative for NATO and the EU.”

Zaev said he would seek to secure the required two-thirds majority of the 120-seat parliament by next week for the constitutional changes. If he fails, he said the only alternative would be to call early elections.

The deal with Greece has faced vociferous opposition from a sizeable portion of the population on both sides of the border, with detractors saying their respective governments conceded too much to the other side and damaged national interests and identity.

The referendum stirred strong interest in the West, with German Chancellor Angela Merkel and U.S. Defence Secretary Jim Mattis among a long line of foreign officials who visited Skopje ahead of the vote to urge Macedonians to back the deal.

Russia, however, is not keen on NATO expanding in a part of Europe once under its sphere of influence. Mattis said there was “no doubt” Moscow had funded groups inside Macedonia to campaign against the name change.

In Athens, the Greek foreign ministry noted the “contradictory” result of the referendum - overwhelming approval along with low turnout - and said careful moves were needed to “preserve the positive potential of the deal.”

The agreement faces more hurdles before it can be finalized. If the constitutional amendments are approved by Macedonia's parliament, Greece will then also need to ratify it.

But Greek Prime Minister Alexis Tsipras faces political problems of his own. His governing coalition partner, right-wing Independent Greeks head Panos Kammenos, has vowed to vote against the deal, leaving Tsipras reliant on opposition parties and independent lawmakers to push it through.

The June agreement aims to resolve a dispute dating from Macedonia's declaration of independence from Yugoslavia in the early 1990s. Greece, arguing its new northern neighbour's name implied territorial ambitions on its own province of the same name, has blocked Macedonia's efforts to join NATO since then.

Under the deal, the former Yugoslav republic would amend its name to North Macedonia and Greece would drop its objections to the country joining NATO.

Supporters, led by Zaev, had characterized Sunday's vote as a linchpin of Macedonia's future prosperity, the key to its ability to join international institutions. NATO and EU membership would be a major step for a country that less than two decades ago almost descended into civil war, when parts of its ethnic Albanian minority took up arms against the government, seeking greater rights.

But opponents painted Sunday's vote as a clear failure.

“The fact is that the agreement with Greece did not receive a green light,” said Hristijan Mickoski, head of the opposition VMRO party. “This today is a defeat not only for the agreement with Greece, but for the crime of those who are in power.”

However, the government had called the referendum consultative and non-binding, meaning it could interpret the outcome as a fair reflection of public opinion regardless of how many people voted. If the referendum were binding, the Macedonian Constitution requires a minimum turnout of 50 per cent of eligible voters to be valid.

The question posed to voters was: “Are you in favour of membership in NATO and European Union by accepting the deal between (the) Republic of Macedonia and Republic of Greece?”

Critics of the name change include President Gjorge Ivanov, who has called the agreement with Greece a “flagrant violation of sovereignty.”

Boycott supporters were jubilant.

“We don't recognize any other Macedonia but Macedonia. No North Macedonia,” said Nevenka Ristovska, who was among opponents of the deal celebrating outside parliament, waving red-and-yellow Macedonian flags.