Nikola Gruevski said his center-right VMRO-DPMNE had won enough votes to gain a majority of parliament's 120 seats, and opposition leader Radmila Sekerinska conceded defeat.
Sunday's violence was a blow to Macedonia's hopes of proving its credentials to join the European Union and NATO. But Gruevski said in his victory speech that while he regretted the violence, the vote was mostly fair and peaceful.
"Macedonia has the power to go ahead. The country has the energy for progress to join NATO and EU," he said.
Hundreds of Gruevski's supporters spilled onto the main square in Skopje, the capital, to celebrate, waving party flags and chanting his name.
Jovan Josifovski, the head of the state election commission, said with votes from 97 percent of polling stations counted, VMRO won 48.21 percent of the vote — far ahead of the Social Democrats' 23.19 percent.
The Democratic Party of Albanians had about 10.33 percent, while the rival ethnic Albanian Democratic Union for Integration had about 11.23 percent.
On Sunday, one person was killed and eight wounded in shootouts between rival ethnic Albanian groups or in standoffs with police, Interior Ministry spokesman Ivo Kotevski said. Twenty-one people were arrested.
The violence in ethnic Albanian areas forced authorities to suspend voting in 22 polling stations — 1 percent of the country's total, commission spokesman Zoran Tanevski said.
The government said voting would be repeated in those polling stations in two weeks.
"We are deeply concerned by the many ... corroborated reports of not only acts of intimidation, but also blatant violence, shooting, injuries to innocent people," Erwan Fouere, head of the European Union office in Macedonia, told The Associated Press.
Ethnic Albanians make up about a quarter of Macedonia's 2.1 million people. Rebels fought a six-month insurgency in 2001 for more rights, but now the two main ethnic Albanian political parties are locked in bitter rivalry.
For weeks, the parties — the Democratic Union for Integration (DUI) led by former rebel leader Ali Ahmeti, and Menduh Thaci's Democratic Party of Albanians (DPA) — have been embroiled in a frequently violent campaign.
Tensions between the two have been high since the 2006 elections, when Gruevski picked the DPA as a governing coalition partner, even though it had won less votes than the DUI.
Those detained Sunday included former rebel commander Agim Krasniqi, who had led a group of 50 armed people into a village north of Skopje in 2004 claiming the government and ethnic Albanian leaders had broken promises to provide former rebels with amnesty and jobs.
Ahmeti's DUI said it would not recognize election results in seven municipalities, including in the main ethnic Albanian town of Tetovo, in the country's northwest, because of the violence.
"Macedonia has failed in the test of organizing free and democratic elections, which is the key test to establish a democratic state," said DUI election official Izet Mexhidi.
Macedonia had hoped the election would produce a strong government, and would prove the country was a suitable candidate for EU membership. Macedonia also was upset over being blocked from joining NATO by neighboring Greece because of a dispute over the country's name.
Even before the election, international observers recorded at least 13 reports of attacks, including several machine gun assaults against DUI offices. In mid-May, Ahmeti's car was shot at in what he described as an assassination attempt. A bystander was wounded.