A local court in Kirov, 500 miles east of Moscow, ordered Mr Navalny’s release pending an appeal over his conviction, which was condemned worldwide as a political tactic designed to silence his criticism of President Vladimir Putin.
The ruling appeared to show indecision or even dispute inside the country’s leadership circles following a wave of public anger.
It came less than 24-hours after the 37-year-old activist and his co-defendant, Petr Ofitserov, a businessman, were handcuffed in a courtroom in the same city and taken into custody.
His conviction was criticsed by across the West, as well as inside the country.
The guilty verdict still stands but a judge — acting on a sudden request from a regional prosecutor - ruled the men should go free until it comes into force, if and when all appeals are exhausted.
Several thousand demonstrators gathered in central Moscow on Thursday evening to protest against the guilty verdict. At least 50 people were detained as police tried to quell the crowds, who briefly held up traffic on Tverskaya Street, shouting “Freedom to Navalny!” and “Putin is a thief!”
After being released from a glass and steel dock on Friday morning, Mr Navalny thanked his supporters, embraced his wife and said he wanted to “hug everybody who contributed to what happened today”.
He said he would decide on his return to Moscow whether he would take part in the city’s mayoral elections on September 8, for which he registered as a candidate earlier this week.
“I’m not some kind of pet kitten or puppy whom they first throw out of the elections, saying ‘You won’t take part”, and then say, ‘No, let’s release him for a month, he’s going to run in the elections,” he said.
Mr Navalny added that he was unaware until Friday morning that prosecutors had asked the previous evening to challenge the legality of the decision to arrest him and Mr Ofitserov in court and take them into custody.
“I didn’t know a thing,” he wrote in a blog post, saying he was “drawing up a strategic plan for a merciless war against the mosquitoes in my cell” when a guard told him to gather his belongings.
He stressed that it was protesters’ “resolve” that had forced the authorities to release him and Mr Ofitserov.
Popular writer Boris Akunin said the opposition should draw strength from the activist’s release. “Now everything could change,” he commented. “Undoubtedly, Navalny now becomes a very real pretender to victory. He and his team know how to work with people much better than the sour Sobyaninites.”
Sergei Sobyanin, 55, is the current mayor of Moscow, a faithful ally of Mr Putin who is expected to retain his job in the September election, partly due to overwhelming bureaucratic and state-media support.
Mr Navalny came to prominence in 2011 when he was one of the leaders of large street demonstrations in Moscow against the results of parliamentary elections allegedly rigged by the Kremlin. He has not ruled out running for the presidency in 2018.
Some analysts suggested that Mr Navalny was deliberately released in order that he be discredited in a one-sided battle with Mr Sobyanin in the mayoral vote before having his appeal refused and being sent back to jail.