Judge Suleiman Yusuf of the Upper Shariah Court in the rural town of Ningi said Daso Adamu's conviction in September was based on flawed evidence.
Adamu, whose conviction was based on her giving birth, had been married and divorced twice. She had allegedly confessed to committing adultery but later retracted the confession.
The man she named as the father of her baby had been acquitted of adultery by the lower court for lack of evidence.
In quashing her conviction, the court in Ningi ruled that Adamu could have been made pregnant by a former husband.
Under the interpretation of Shariah law (search) here, men can be convicted of adultery only on the basis of witness statements, while pregnancy is considered sufficient evidence to convict women.
In all but one case in Nigeria, men have been cleared, as Shariah courts found there was insufficient evidence to prove they had sex with the women.
None of a dozen stoning-death sentences passed since 12 states in predominantly Muslim northern Nigeria adopted strict Shariah law four years ago have been carried out.
President Olusegun Obasanjo has criticized harsh sentences under Islamic law but has not moved to ban them because states are empowered to make laws in Nigeria's federal system.