* Sharif likely to form strong government
* Voters deliver blow to PPP, leader of previous government
* Former cricket star Imran Khan's party put up strong fight (Adds Obama comments)
By Mehreen Zahra-Malik and Katharine Houreld
ISLAMABAD, May 12 (Reuters) - Toppled in a 1999 military coup, jailed and exiled, Pakistan's Nawaz Sharif has made a triumphant election comeback and looks set to form a stable government capable of implementing reforms needed to rescue the fragile economy.
Sharif may not win enough seats to rule on his own but has built up enough momentum to avoid having to form a coalition with his main rivals, former cricketer Imran Khan's Tehrik-i-Insaf (PTI) and the Pakistan People's Party (PPP).
The steel magnate held off a challenge from Khan, who had hoped to break decades of dominance by Sharif's Pakistan Muslim League (PML-N) and the PPP, led by the Bhutto family.
The two parties have formed governments whenever the military, the most powerful institution in the nuclear-armed nation, has allowed civilian rule.
U.S. President Barack Obama congratulated Pakistanis for the successful election and said the United States would work with the new government as an equal partner.
"By conducting competitive campaigns, freely exercising your democratic rights, and persevering despite intimidation by violent extremists, you have affirmed a commitment to democratic rule that will be critical to achieving peace and prosperity for all Pakistanis for years to come," Obama said in a statement.
But facing Islamist militant violence, endemic corruption, chronic power cuts and crumbling infrastructure, even Sharif has described Pakistan as a "mess".
Khan put up a strong fight and he is likely to remain a force in politics, possibly becoming the main opposition figure. The PPP, which led the government for the last five years, has done badly and could come in third place.
Television channels said of the results declared by Sunday evening, Sharif's PML-N had captured 94 of the 272 contested National Assembly seats.
Based on trends, it was likely to get around 130, and should easily be able to make up the required majority of 137 with support from independents and small parties.
The PTI has secured 21 seats while the PPP won 19.
The elections, held on Saturday, were marred by a campaign by Islamists to block the voting. Despite pre-poll violence and attacks that killed at least 40 people, voter turnout was a robust 60 percent.
Once it establishes a majority, Sharif's party would be allocated a majority of 70 other parliamentary seats that are reserved for women and non-Muslim minorities.
Sharif has waited patiently to rule Pakistan again. As the main opposition leader, he avoided undermining the PPP when it was in trouble, and analysts describe him as more cautious than when he was prime minister twice in the 1990s.
"Seemingly a genuinely changed man from his troubling stints as prime minister in the 90s, Sharif now appears to have both a genuine mandate as well as a grasp of the direction Pakistan needs to be steered in," said political analyst Cyril Almeida.
In one sense, the polls were a democratic landmark, marking the first time one elected government was to replace another in a country vulnerable to military takeovers.
But Saturday's vote failed to realise the hopes of many that the hold of patronage-based parties would end after years of misrule and corruption.
Sharif, 63, is almost certain to become prime minister for a third time. The religious conservative has said the army, which has ruled the country for more than half of its turbulent 66-year history, should stay out of politics.
But he will have to work with Pakistan's generals, who set foreign and security policy and will manage the country's thorny relationship with the United States as NATO troops withdraw from neighbouring Afghanistan in 2014.
Sharif also believes Pakistan should reconsider its support for the U.S. war on Islamist militancy, which has earned the country billions of dollars in aid.
Sharif, who advocates free-market economics, is likely to pursue privatisation and deregulation to revive flagging growth. He has said Pakistan should stand on its own two feet but may need to seek a another bailout from the International Monetary Fund to avoid a balance of payments crisis.
The PML-N leader has said he could do business with the IMF, meaning he may be open to reforms like an easing of subsidies and a widening of Pakistan's tiny tax base to secure billions of dollars from the global lender.
"A better-than-expected result for Nawaz could prove to be an albatross around his neck," said Muhammad Malick, a popular current affairs broadcaster.
"With an overwhelming majority of seats and without needing the crutch of coalition partners to form government, he will have fewer excuses for failure on key policy issues such as the economy and terrorism."
In a reminder of the security challenges that Sharif will face, a blast on a bus in the tribal area of North Waziristan killed 19 people on Sunday, security officials said.
Sharif will likely press for negotiation with the Pakistan wing of the Taliban, whose bombing attacks failed to derail the election, but he could run into resistance from the military which has lost thousands of soldiers fighting the insurgency.
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 the election.
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's rule.
In the end, cricketing hero Khan 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.
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, widely seen as a violation of sovereignty.
In a video message, Khan said the election would boost Pakistan's young democracy, but added his party was collecting evidence of what he said was vote-rigging.
"We are now moving towards democracy. I congratulate the nation on the numbers in which they turned out to vote. The youth was with me. That is my victory," he said. (Additional reporting by Mehreen Zahra-Malik and Katharine Houreld in ISLAMABAD, Gul Yousafzai in QUETTA, Mubasher Bukhari in LAHORE and Jibran Ahmed in PESHAWAR; Writing by Michael Georgy; Editing by Raju Gopalakrishnan and Jon Hemming)