By Ivana Sekularac and Kole Casule
SKOPJE (Reuters) - Macedonia's nationalist VMRO-DPMNE and opposition Social Democrats were virtually tied in a Sunday election aimed at ending a two-year-long crisis that brought down the previous government, state election commission preliminary results showed.
The center-right VMRO-DPMNE of former Prime Minister Nikola Gruevski won 37.96 percent of the vote, while the Social Democrats, or SDSM, of Zoran Zaev won 36.65 percent, the commission showed on its website. Results were based on the counting of nearly 98 percent of the votes.
A final result is expected around midday on Monday.
- PHOTOS: A look back at Queen performing in the 1970s and 1980s 22 Pictures
- All of these celebrities have had their nudes leaked 35 Pictures
The Association Most election monitor said the race was too close to estimate each party's number of seats in parliament, based on a representative sample it had identified.
"The two leading parties according to the number of votes won are too close to each other, and this difference in the number of votes won influences the deployment of the seats, depending on the margin of error," Most said in a statement early on Monday.
The parliamentary elections came almost a year after Gruevski stepped down as prime minister in a European Union-brokered deal to end a crisis over a corruption scandal in the landlocked nation of 2.1 million people.
Gruevski's main challenger, Zaev, accused the government last year of wiretapping tens of thousands of citizens and released recordings appearing to implicate the government in corruption. Gruevski has denied any wrongdoing.
The VMRO-DPMNE party had ruled on its own or as the major coalition party since 2006 until the installation of a caretaker government and the calling of early elections last January.
The SDSM was celebrating what it said was its victory in bigger cities on Sunday night.
"The regime fell. The entire world should understand that we wrote history today," Zaev told supporters in front of the government building in Skopje.
Gruevski claimed victory for his party.
"VMRO-DPMNE is the winner of these elections. Today, VMRO-DPMNE won, but also Macedonia won," he told supporters in Skopje.
Whoever forms the government will have to seek a coalition partner among parties representing ethnic Albanians, who account for one-third of the population.
In Romania, the leftist Social Democrats, also seeking re-election after stepping down a year ago amid street protests over its failure to address corruption, were in position to form a coalition government again on Sunday.
Early elections were postponed twice in Macedonia after the opposition boycotted them, demanding measures to ensure voting would be free and fair.
"I am hoping that this madness will stop after the election. I hope a better party will win," said unemployed 52-year-old Orde Serafimovski, casting his vote earlier in the day.
The European Union had long criticized Gruevski's record on democracy and the rule of law, but also needs Macedonia's cooperation to help contain the bloc's migration crisis. The country sits on a major migration route into the bloc.
Macedonia is a candidate to join the European Union but has never begun accession talks, partly because of criticism of its reform record and an entrenched dispute with neighboring EU member Greece over the name Macedonia, which also belongs to a northern Greek province.
Eleven parties and coalitions ran for election, including four representing the ethnic Albanian community. Traditionally, an Albanian party joins a coalition government as junior partner.
(Writing by Georgina Prodhan; Editing by Will Dunham and Peter Cooney)