* Eleven killed, at least 37 wounded in Karachi attacks
* Election to bring first transition between civilian governments
* Former premier Nawaz Sharif's party looks set to win most votes
* Late surge of support for cricketer-turned-politician Imran Khan (Updates violence, adds details on election)
By Katharine Houreld and Mehreen Zahra-Malik
ISLAMABAD, May 11 (Reuters) - A string of militant attacks cast a long shadow over Pakistan's general election on Saturday, but millions still turned out to vote in a landmark test of the troubled country's democracy.
The poll, in which some 86 million people are eligible to vote, will bring the first transition between civilian governments in a country ruled by the military for more than half of its turbulent history.
A bomb attack on the office of the Awami National Party (ANP) in the commercial capital, Karachi, killed 11 people and wounded 35. At least two were wounded in a pair of blasts that followed and media reported gunfire in the city.
An explosion destroyed an ANP office in the northwest. There were no immediate reports of casualties. Television channels also reported an explosion in the city of Peshawar.
Pakistan's Taliban, who are close to al Qaeda, have killed more than 120 people in election-related violence since April. The group, which is fighting to topple the U.S.-backed government, regards the elections as un-Islamic.
The Taliban have focused their anger on secular-leaning parties like the ruling coalition led by the Pakistan People's Party (PPP) and the ANP. Many candidates, fearful of being assassinated, avoided open campaigning before the election.
The people of Pakistan hope the polls will deliver change and ease frustrations with the Taliban, a frail economy, endemic corruption, chronic power cuts and crumbling infrastructure.
Disenchantment with the two mainstream parties appears to have brought a late surge of support for former cricket star Imran Khan, who could end up holding the balance of power.
Khan, 60, is in hospital after injuring himself in a fall at a party rally, which may also win him sympathy votes.
Results from nearly 70,000 polling stations nationwide are expected to start tricking in from around 10 p.m. (1700 GMT).
"The problems facing the new government will be immense, and this may be the last chance that the country's existing elites have to solve them," said Anatol Lieven, a professor at King's College, London, and author of a book on Pakistan.
"If the lives of ordinary Pakistanis are not significantly improved over the next five years, a return to authoritarian solutions remains a possibility," Lieven wrote in a column in the Financial Times.
The army stayed out of politics during the five years of the last government, but it still sets the nuclear-armed country's foreign and security policy and will steer the thorny relationship with Washington as NATO troops withdraw from neighbouring Afghanistan next year.
With no clear-cut winner, weeks of haggling to form a coalition will follow, which would raise the risk that the government is undermined by instability.
That would only make it more difficult to reverse the disgust with politicians felt among the country's 180 million people and drive through the reforms needed to revive its near-failed economy.
Power cuts can last more than 10 hours a day in some places, crippling key industries like textiles, and a new International Monetary Fund bailout may be needed soon.
The party of former prime minister Nawaz Sharif looks set to win the most seats in the one-day vote. But Khan could deprive Sharif of a majority and dash his hopes for a return to power 14 years after he was ousted in a military coup, jailed and later exiled.
Pakistan's best-known sportsman, who led a playboy lifestyle in his younger days, Khan is seen by many as a refreshing change from the dynastic politicians who long relied on a patronage system to win votes and are often accused of corruption.
LATE SURGE FOR IMRAN KHAN
Voters will elect 272 members of the National Assembly and to win a simple majority, a party would have to take 137 seats.
However, the election is complicated by the fact that a further 70 seats, most reserved for women and members of non- Muslim minorities, are allocated to parties on the basis of their performance in the contested constituencies. To have a majority of the total of 342, a party would need 172.
Khan appeals mostly to young, urban voters because of his calls for an end to corruption, a new political landscape and a halt to U.S. drone strikes on Pakistani soil. About one-third of the country's population is under the age of 30.
Early opinion polls had put the share of votes for Khan's Tehrik-i-Insaf (PTI) party as low as single figures. However, a survey released on Wednesday showed nearly 25 percent of voters nationally planned to vote for his party, just a whisker behind Sharif's Pakistan Muslim League (PML-N).
The Herald magazine poll showed Sharif's party remained the front-runner in Punjab, which, with the largest share of parliamentary seats, usually dictates the outcome of elections.
It also pointed to an upset for the PPP, placing it third. Pakistan's politics have long been dominated by the PML-N and the PPP, whose most prominent figure is President Asif Ali Zardari, widower of assassinated former premier Benazir Bhutto.
"The PPP didn't take care of the poor masses and always engages in corrupt practices whenever they come to power," said Sher Nabi, a banker from Peshawar.
"So we've decided to vote for the PTI candidate this time and test Imran Khan to see if he proves as honest as he claims."
Pakistan, which prides itself on its democratic credentials, ordered the New York Times bureau chief in Islamabad to leave the country on the eve of the polls, the daily said on Friday.
A two-sentence letter was delivered by police officers to the home of the bureau chief, Declan Walsh, it said.
"It is informed that your visa is hereby cancelled in view of your undesirable activities," the Times quoted the letter as saying, without explaining what was undesirable. "You are therefore advised to leave the country within 72 hours." (Writing by John Chalmers and Michael Georgy; Additional reporting by Gul Yousafzai in QUETTA, Mubasher Bukhari in LAHORE and Jibran Ahmed in PESHAWAR; Editing by Nick Macfie)