During the campaign, 63-year-old Sharif had vowed to revive the Indo-Pak peace process which was interrupted in 1999 by the then military ruler Pervez Musharraf who ousted him in a bloodless coup, jailed and exiled. He had started the peace process with then Prime Minister Atal Bihari Vajpayee.
In New Delhi, Prime Minister Manmohan Singh lost no time in congratulating Sharif for his "emphatic victory" in the elections and invited him to visit India at a mutually convenient time.
According to state-run PTV, the unofficial results announced till late Sunday night showed that Sharif's PML (N) is leading with 118 seats of 272 parliamentary seats that went to the polls on Saturday. Sharif needs 137 seats for a majority.
According to trends, Sharif is likely to get 125 seats.
Sharif may marginally fall short of absolute majority but will be able to make it up by getting the support of independent candidates and smaller rightist parties like the Jamiat Ulema-e-Islam which was ahead in 11 seats.
Imran Khan's Pakistan Tehrik-e-Insaf (PTI), about which there was considerable hype, lagged behind bagging 32 seats.
The Pakistan People's Party (PPP), which had a tally of 124 in the 2008 elections and ruled the country for five years with the support of the MQM and the Awami National Party, has clinched 32 seats.
The results showed Sharif's party virtually swept the polls in central and upper parts of Punjab while it also performed well in parts of southern Punjab.
PTI almost demolished its opponents in Khyber Pakhtunkhwa. PML (N) has also emerged as leading party in the Punjab Assembly. PPP seems to have maintained its dominance in interior Sindh, the state-TV said.
Sharif is set to return to power at a time when Pakistan is facing several major challenges, including growing extremism, a strong Taliban presence in the country's northwest, rampant corruption, uneasy relations with the US ahead of the withdrawal of foreign forces from war-torn Afghanistan and an economy that has virtually been in free fall for the past few years.
Sharif served as premier during 1990-1993 and 1997-1999 but was ousted from office before he could complete his term - once on corruption charges and later because of the coup led by Musharraf.
Sharif won two seats both from Sargodha and Lahore while Imran Khan bagged three seats in the national assembly out of four he contested.
President Asif Ali Zardari's sister Faryal Talpur, Farooq Sattar, Syed Khurshid Ahmed Shah, Sheikh Rashid, Fehmida Mirza, Makhdoom Amin Fahim, Ahsan Iqbal and Sardar Ayaz Sadiq have also emerged successful.
Among the towering leaders who were made to bite the dust include former prime minister Raja Pervez Ashraf and former ministers Ghulam Ahmed Bilour, Faisal Saleh Hayyat, Ameer Muqam, Qamar Zaman Kaira, Firdous Ashiq Awan, Mian Manzoor Wattoo, Khurshid Kasuri, Syed Samsam Bukhari, Sardar Mehtab Abbasi, Tasneem Ahmed Qureshi, Chaudhry Ahmed Mukhtar, Chaudhry Anwar Ali Cheema And Shakeel Awan, Abdul Qadir Gilani, Yasmin Rashid and Abrarul Haq, the PTV said.
The PML-N was returned to power at the national level after millions of Pakistanis braved Taliban threats and violence that claimed some 50 lives to vote in the landmark general elections that marked the first transition from one civilian government to another in the country's 66-year history, which has witnessed numerous military coups.
Sharif proclaimed victory for the PML-N while addressing a group of jubilant supporters at his home in Lahore on Saturday night and asked people to pray that the final results would deliver an "absolute majority" for his party so that he would not have to lead a weak coalition.
PML-N supporters took to the streets in droves to celebrate the victory. Overwhelmed by the victory, they fired in the air at several places in Lahore, violating the Election Commission's code of conduct.
Conceding defeat, Khan from his hospital bed said, "I have seen many ups and downs in my life. But I forget the pain of this defeat when I see the enthusiasm of the youngsters."
"I want to thank the electorate for coming out in such large numbers. This is significant for Pakistan. The people have decided that they will play a role in forming the future of Pakistan through their vote," 60-year-old Khan said.
Analysts said it was possible that the Muttahida Qaumi Movement, leading in 12 seats, could back Sharif in forming the government.
To win a majority, a party or coalition would have to bag 137 of the 272 National Assembly seats for which polls were held. Another 70 seats in the 342-member National Assembly are reserved for women and non-Muslims and will be allocated to parties according to their performance in polls.