LAHORE, Pakistan—A conservative former Pakistani prime minister ousted in a 1999 military coup, Nawaz Sharif, headed toward leading the nuclear-armed nation for the third time after Saturday's election that also turned populist cricket legend Imran Khan into a major political force, according to nearly complete results.

Mr. Sharif's Pakistan Muslim League-N was leading the vote count in 127 constituencies out of 272. Mr. Khan's Pakistan Tehreek-e-Insaf, which boycotted the previous election in 2008, was leading in 34 races, while the Pakistan Peoples Party that controlled the previous government trailed in third place with 30 seats. With independents and small parties eager to back a winner, this showing would make it easy for Mr. Sharif to form the next government of the world's fifth largest democracy.

The election would mark the first time in Pakistan's coup-ridden history that a civilian government served a full five-year term and transferred power to another elected administration. Turnout was close to 60%, according the country's election commission, much higher than the 44% in the previous vote, despite Taliban threats and scattered violence that killed at least 19 people.

"Pakistan needs a strong government that can take strong decisions," Mr. Sharif said as he watched the results stream in on TV in his Lahore headquarters, with cheers by supporters outside growing louder with every new projection. As his lead solidified, he came out to make a victory speech, urging supporters to pray for an outright PML-N majority by the end of the count, so that a future government could be established "without crutches."

Mr. Sharif, in an interview with The Wall Street Journal after the vote, said he foresaw no new problems with the country's powerful military establishment, saying that the 1999 coup against him was the personal initiative of then-army chief Gen. Pervez Musharraf, and not the military as a whole.