You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
The polls were a landmark, marking the first time one elected government will replace another. But the vote failed to realise the hopes of many that dynastic politics would end after years of misrule and corruption.
The wealthy steel magnate from the pivotal Punjab province held off a challenge from former cricket star Imran Khan who had hoped to break decades of dominance by Sharif and the Pakistan People's Party led by the Bhutto family.
Sharif, 63, declared victory in a jubilant speech to supporters as results from Saturday's election showed a overwhelming lead for his party.
"Results are still coming in, but this much is confirmed: we're the single largest party so far," he declared to hoots of joy from the crowd in Punjab's capital, Lahore.
"Please pray that by morning we're in a position that we don't need the crutch of coalition partners."
Despite pre-election violence and attacks on Saturday that killed at least 17 people, millions turned out to cast their ballot in a milestone election for a country that has been ruled by the military for more than half of its turbulent history.
With the count continuing into the night, Sharif's Pakistan Muslim League - Nawaz (PML-N) was leading in 119 of the 272 National Assembly seats that were contested.
His party may not have enough seats to rule on its own and may be forced into a coalition, which could make it difficult to push reforms desperately needed to revive a near-failed economy.
Sharif, who advocates free-market economics, is likely to pursue privatisation and deregulation to revive flagging growth.
He will have to ease widespread discontent over endemic corruption, chronic power cuts and crumbling infrastructure in the nuclear-armed country, a strategic U.S. ally. One of the first likely tasks will be to negotiate with the International Monetary Fund for a multi-billion-dollar bailout.
Cricketing hero Khan in the end did not have the momentum needed to trip up Sharif despite his popularity among urban youths, many of whom were voting for the first time in an election that saw a robust turnout of 60 percent.
They had rallied behind Khan's calls for an end to graft and a halt to U.S. drone strikes against suspected militants on Pakistani soil.
Still, Khan's Tehrik-i-Insaf (PTI) put up a strong fight against the PPP, with the count showing the two parties neck-and-neck with about 34 seats each. The PPP led the government for the past five years with 124 lawmakers in parliament.
"Nawaz's victory says two things about Pakistan: one, the people of Pakistan prefer the comfort of status quo over the uncertainty of revolutions; and two, all roads to the centre go through Punjab, and in Punjab, people are right-leaning and conservative," said senior journalist Nusrat Javeed.
"Still, for a party that only really arrived on the political scene in a serious way two years ago, PTI's performance was remarkable, to say the least."
BLOODY ELECTION DAY
A string of bomb blasts marred election day, with one attack on a party office in the southern city of Karachi killing 11 people and wounding about 40.
Pakistan's Taliban, which is close to al Qaeda, has killed more than 125 people in election-related violence since April. The group, which is fighting to topple the U.S.-backed government, regards the poll as un-Islamic.
Despite Pakistan's history of coups, the army stayed out of politics during the five years of the last government and threw its support behind Saturday's election.
It still sets foreign and security policy and will steer the thorny relationship with Washington as NATO troops withdraw from neighbouring Afghanistan in 2014.
However, some fear the military could step back in if there were a repeat of the incompetence and corruption that frustrated many Pakistanis during the last government.
Sharif, who was toppled in a 1999 bloodless coup by former army chief Pervez Musharraf, has said generals have no place in politics.
He may also take steps to improve ties with Pakistan's arch-enemy, India. Efforts to boost trade between the neighbours have stalled due to suspicion on both sides.
If Sharif is forced into a coalition he may look to Islamist parties to cobble together a majority in parliament.
On top of the 272 contested seats, a further 70 - most reserved for women and members of non-Muslim minorities - are allocated to parties on the basis of their performance in the constituencies. To have a majority of the total of 342, the government would need 172 seats.