* Putin opponent is underdog against Kremlin appointee
* Navalny faces five years in prison if he loses appeal
* Strong showing after lively campaign could rattle Kremlin
Russian opposition leader Alexei Navalny faced off against an entrenched Kremlin ally on Sunday in a Moscow mayoral election with high stakes for both President Vladimir Putin and his foes.
The closely-watched contest to head Russia's capital will help shape Putin's six-year third term and the fortunes of two politicians who could play bigger roles in the future.
For underdog Navalny, an anti-corruption campaigner who emerged from a wave of street protests as the driving force of opposition to Putin's 13-year rule, the vote is a chance to show many Russians want change and he is the man to make it happen.
It pits him against Sergei Sobyanin, a former Putin administration chief who was appointed to a five-year term by the Kremlin in 2010 but called an early election to bolster his legitimacy and strengthen his position.
The threat of jail hangs over Navalny, 37, who was convicted in July of stealing timber for a state firm and sentenced to five years in prison after a trial he and his supporters say was politically motivated.
In a highly unusual ruling, a judge released him the following day pending a ruling on appeal, enabling him to continue his mayoral campaign.
Many political observers say the Kremlin wanted Navalny to run because it expected him to be humiliated and believed this would wipe out any political threat from a harsh critic who has presidential ambitions.
But while opinion polls have shown Navalny has little or no chance of winning, his lively campaign has revived some of the enthusiasm of a flagging protest movement and may have rattled the Kremlin.
A strong showing for Navalny could deepen Kremlin concerns and boost the morale of Putin's opponents - particularly if Sobyanin were to fall short of 50 percent of the votes, forcing him into a run-off vote later this month.
Most polls have shown that is unlikely and the Kremlin seems confident it will not happen. Kremlin sources said Putin was pencilled in to attend the mayor's inauguration this week.
Navalny and Sobyanin, 55, are among six candidates fighting for the ballots of nearly 7.2 million registered voters in Russia's biggest and wealthiest city, its main financial centre and the seat of most big Russian companies.