Cheikh Ould Mohamed Ould Mkheitir's had his sentence reduced to two years on Thursday and swiftly released as he had been in custody since January 2014.
"It's a great victory. The law has been pronounced and religion has been respected," said one of his lawyers, Fatimata Mbaye.
However, prosecutors on Friday said they had filed an appeal to the Supreme Court against the two-year sentence.
Mkheitir, a Muslim in his 30s who is also known as Mohamed Cheikh Ould Mohamed, was sentenced to death in December 2014.
His blog was accused of questioning decisions taken by the Prophet Mohammed and his companions during holy wars in the seventh century.
He also attacked the mistreatment of the country's black population, blasting "an iniquitous social order" with an underclass that was "marginalised and discriminated against from birth", and condemned the use of religion to justify discrimination against his caste.
On April 21, 2016, the court of appeal confirmed the death penalty, but reclassified the crime from blasphemy to "unbelieving," for which the punishment is less if the defendant repents.
The case was then sent to the Supreme Court, which on January 31 this year sent it back to the appeals court "in order to correct mistakes made," without elaboration.
Prisoner of conscience
The case generated strong protests from international rights watchdogs but also a clamour within this conservative country for the death penalty to be carried out.
Groups that campaigned for his release include Reporters without Borders, Amnesty International and Human Rights Watch (HRW).
The defendant is a "prisoner of conscience, detained for three years solely for exercising his right to freedom of expression and speaking out against discrimination," HRW said in a statement ahead of the trial.
Amnesty's West and Central Africa head Alioune Tine called Mkheitir's release "a huge relief" as he had "been jailed for nearly four years simply for peacefully expressing his opinions".
The ruling "provides a golden opportunity for the Mauritanian authorities to... halt their brutal crackdown on human rights activists," he said in a statement. It also called on the authorities to ensure Mkheitir was able to live "without threat of physical attacks so that he can regain his dignity".
In contrast, as the Supreme Court was deliberating in January, several thousand people gathered in Nouakchott, the capital, chanting slogans to demand that Mkheitir be executed.
Capital punishment in Mauritania, a vast, mainly desert state in west Africa, is usually reserved for murder and acts of terrorism.
According to Amnesty, Mauritania last executed a prisoner in 1987.
Mkheitir on Wednesday told judges that he had "uncovered mistakes in his article" which he "immediately corrected in another article.
He also expressed "every repentance and apologies" and assured the court of his "faith in Allah and his prophet".
When the sentence was read out on Thursday, women in court began weeping and insults were hurled against the judiciary and the government, accused of "choosing the West over the Prophet," witnesses said.
Attorneys for the defence left the court under police protection. Police patrols in the town were stepped up in the morning ahead of the verdict's announcement, apparently to thwart any protest.
Mkheitir was also fined 60,000 ouguiyas (146 euros, $169) by the court in northwestern Nouadhibou, a legal source said.