Turkey's Prime Minister Recep Tayyip Erdogan has claimed victory for his party in local elections, and vowed that his enemies would "pay the price".
Mr Erdogan's government has been accused of authoritarianism and corruption after a string of scandals.
The local elections, the first vote since mass protests last June, were seen as a barometer of his popularity.
Mr Erdogan was not standing for election but campaigned hard for his Justice and Development Party (AKP).
With over 60% of the votes counted, it was leading the main opposition party 47% to 27%.
The AKP had been aiming to equal or better its 38.8% share of the vote in the last local elections in 2009.
Speaking from a balcony at his party's headquarters in Ankara, Mr Erdogan thanked his supporters.
"You stood up for Turkey's ideals... for politics, for your party and your prime minister," he said.
But he warned he would "enter the lair" of enemies who had accused him of corruption and leaked state secrets. "They will pay for this," he said.
Voting in the local assembly and mayoral elections passed off peacefully in most areas, but eight people were reportedly killed in two separate incidents involving supporters of rival candidates.
Feuding families were said to have clashed in the southern city of Hatay and the eastern province of Sanliurfa.
The prime minister has been eyeing a run for the presidency in August - the first time voters will directly elect the head of state - or may seek to change the rules to allow him to seek a fourth term in office.
The BBC's James Reynolds in Istanbul says Mr Erdogan's success is due to a solid base among religious and working-class groups across the country.
In the run-up to Sunday's poll, the government blocked Twitter and YouTube, following a series of online leaks.
Mr Erdogan said social media was spreading misinformation.
On Saturday pro- and anti-government factions held rival demonstrations in Istanbul, which saw the Gezi Park protests of May and June last year.
The secular opposition Republican People's Party (CHP) is fighting to win the Istanbul mayor's office from Mr Erdogan's ally Kadir Topbas. However, early results put the AKP ahead.
Mr Erdogan is a former mayor of the city and the vote there has become an unofficial referendum on his administration.
The race looked tighter in the capital Ankara, with Erdogan's party narrowly leading the CHP.
The loss of either city would be a major embarrassment for the prime minister.
More than 50 million people are eligible to vote, and turnout in the local elections appeared to be high.
The prime minister has purged hundreds of people from the judiciary and police since several of his allies were arrested over a corruption scandal in December.
He has accused the judiciary of being behind a series of wiretaps and social media leaks allegedly exposing major corruption.
The scandal has pitted the prime minister against a former ally, US-based Islamic scholar Fethullah Gulen, who has many supporters in the police and judiciary.
Mr Erdogan accuses Mr Gulen of using his supporters in a "dirty campaign" to try to topple him.
Mr Gulen denies the allegations but those close to the movement, known as Hizmet ("Service"), say they fear a crackdown after the elections.
The Islamist-rooted AK Party swept to power in 2002 on a platform of eradicating the corruption that blights Turkish life.
It was backed by a pious Muslim base looking for greater standing in a country that historically favoured a secular elite.
The government faced major street protests last year sparked by plans to raze Istanbul's Gezi Park and redevelop it. The police crackdown galvanised anti-government demonstrators in several cities.
The anger flared up again earlier this month, with the news of the death of a 15-year-old boy who had been in a coma since last June after being hit by a tear gas canister during a protest.