An ally of President Vladimir Putin won Moscow's mayoral election on Sunday, nearly complete results show.
But opposition leader Alexei Navalny's unexpectedly strong showing could alarm the Kremlin and fuel Russia's flagging protest movement.
Early returns allowed Sergei Sobyanin to say he was certain of victory, and results released by the electoral commission after a nearly complete count showed him narrowly clearing the 50% barrier needed to win outright.
However, Mr Navalny says the results were falsified and his campaign team's figures show Mr Sobyanin has fallen short of the mark, meaning the two should face each other in a second-round runoff.
"We do not accept the results that are being announced, and we will not give up a single vote that we received," says Mr Navalny, a 37-year-old anti-corruption campaigner who emerged from a wave of anti-Putin protests as the opposition's leader.
The results put Mr Navalny on 27.3% but he said his real support is 35%.
His remarks raise the prospect of a new electoral dispute in Russia after protests stalled last year when Mr Putin, a former Soviet spy who has been in power since 2000, won a third presidential term and took a tough line on dissent.
"It is already clear now that the vote count was conducted with many serious violations, and so we consider the official results of the election to be deliberately falsified," the opposition campaign said in a later statement after the bulk of the results were in.
Candidates from United Russia, which dominates politics nationwide, won most of the more than 7,000 regional and local contests across Russia. There was, however, another sign of resistance in the big Ural Mountains city of Yekaterinburg, where opposition candidate Yevgeny Roizman was on track to narrowly defeat the ruling party favourite.
With more than 99% of the vote counted in Moscow, the still preliminary results gave 55-year-old Mr Sobyanin 51.27% of votes and Navalny 27.3%. Two exit polls earlier had put Navalny on about 30% of votes.
A low turnout of about 33% helped to boost his numbers because the young people who form the bedrock of his support voted in droves and there was less mobilisation among elderly, more conservative voters.
Even if Mr Navalny's challenge of the outcome does not succeed, such figures strike a blow for the opposition after a Western-style campaign that appeared to take the Kremlin and Mr Navalny's rivals by surprise with its energy and professionalism, AFP reports.
Political observers say the Kremlin let Mr Navalny run for mayor in the belief that he would suffer a humiliating defeat after being convicted of theft in July and sentenced to five years in prison, pending an appeal.
In an unusual ruling, a court in the city of Kirov released Mr Navalny on bail the day after he was sentenced to allow him to run in the election in the capital, whose 12 million inhabitants account for more than a fifth of the Russian economy.