Bibi had challenged the judgment in the Lahore High Court, which upheld the district court verdict in 2014.
"The judgment of the high court and that of the trial court is reversed," Justice Nisar announced.
Security was beefed up in the capital and elsewhere in anticipation of protests from religious groups that threatened to take to the streets if Bibi was acquitted.
Bibi is likely to leave the country as her family fears for safety.
Blasphemy, against Islam and Prophet Muhammad, is a criminal offense that can carry the death penalty in Pakistan. While the state has never executed anyone under the law, mere allegations have stirred mass protests and violence.
Last April, a student Mashal Khan was beaten to death at his university in the northwestern city of Mardan on similar allegations.
In 2011, a bodyguard shot dead Salman Taseer, governor of the Punjab province, after he declared the blasphemy law as a " black law". His killer was executed in 2016.
Rights group observe that the blasphemy law is often exploited to settle personal scores against religious minorities and say it should be annulled.
Supporters of the law claim it is intended to cover all religions and prevent vigilantism after allegations of blasphemy.
There are nearly 600 blasphemy cases waiting in the courts, of which two thirds involve Muslims.