The court suspended the sentences of Sharif and his daughter Maryam, who were convicted in July, shortly before the country held general elections.
The decision came during their appeal. They have denied wrongdoing.
The ruling comes just a week after Sharif's wife, Kulsoom Nawaz, died from cancer in London.
They were briefly allowed out of prison, in Rawalipindi, to attend her funeral in Lahore, but were later returned.
What was the case about?
Sharif was charged with corrupt practices in July related to ownership of four luxury properties in central London linked to his family.
He says the charges are politically motivated. The three-time prime minister was ousted from power a year earlier by Pakistan's Supreme Court, after his children were linked to offshore companies in the Panama Papers leaks of 2015.
His daughter, Maryam Nawaz Sharif, received seven years for abetting a crime and one year for not co-operating - which were due to run concurrently - while son-in-law Safdar Awan was given a one-year sentence for not co-operating.
The conviction also barred them from seeking public office for up to 10 years after release.
What changed on Wednesday?
All three had the jail sentences imposed by the lower court on 6 July suspended by Islamabad's high court, as part of an appeals hearing.
"The prosecution has failed to show the properties belong to Nawaz Sharif. It also failed to prove how was Maryam Nawaz sentenced under the same charge sheet which convicted Nawaz Sharif," Justice Athar Minallah told the court.
Their convictions remain under appeal within the top court, but a date for a hearing has yet to be fixed.
They are expected to be released soon on bail.
What has the reaction been?
The case against Nawaz Sharif has divided opinion in Pakistan, the BBC's Secunder Kermani says.
His supporters believe the real reason he was convicted was because he had fallen out with the country's powerful army, but his political rivals - including new PM Imran Khan - had hailed his conviction as a victory for accountability, he adds.
Supporters of Sharif cheered outside the court when it gave its order to release him.
The leader of Sharif's party, the PML-N, said the ruling was "a victory for justice", according to Pakistan's Express Tribune.
A senator from Prime Minister Khan's PTI party, Faisal Javad, told a local TV channel: "It is only a suspension. But they are guilty all the same. Their destination remains Adyala Jail."
Sharif had been serving as prime minister for a record third time when he stepped down last year.
He also held the office from November 1990 to July 1993 and from February 1997 until he was toppled in a bloodless coup in October 1999.
More about: Pakistan