Asia Bibi was accused of making derogatory remarks about Islam after neighbours objected to her drinking water from their glass because she was not Muslim.
Aasia Bibi,a Christian woman,has been on death row since 2010 having been convicted of blasphemy after refusing to convert to Islam.
The dramatic release comes almost two months after Sharif's party lost the election in a vote that his party claimed was rigged.
The former cricketer said a long-running refusal to grant Afghans documents or citizens'rights was driving them to crime.
The Trump administration says Islamabad is granting safe haven to insurgents who are waging a 17-year-old war in Afghanistan,a charge Pakistan denies.
Khan's election was only the second democratic transfer of power since Pakistan's 1947 independence.
The conflict today is probably driven less by geopolitics than by internal Indian politics,which have increasingly taken an anti-Muslim direction.
India accuses Pakistan of backing anti-India militant groups and helping them to infiltrate the Kashmir region to stoke violence,charges Pakistan denies.
European Union monitors said the election has not been fought on a level playing field.
Imran Khan's electoral victory was a vote of desperate hope,a plea for change.
Official results show cricket star Imran Khan has won in Pakistan's polls but he will have to seek out allies to form a coalition government.