The verdict in the nation's highest court is another setback for Pervez Musharraf, who ousted Sharif in a bloodless coup in 1999, the Press Trust of India reported.
Sharif and his family were sent to Saudi Arabia after being deposed.
The court, headed by Chief Justice Iftikhar Muhammad Chaudhry, whose suspension by Musharraf in March touched off a storm in the legal community until his reinstatement last month, also gave Sharif permission to participate in the upcoming parliamentary elections.
"The Sharifs can return to Pakistan unhindered," said Chaudhry in his judgment. "They had an inalienable right to return and remain in the country as citizens of Pakistan."
"Their safe return will not be restricted or hampered by the federal governments or provincial governments or any other agencies in any manner," Chaudhry added.