Counting got underway Saturday in Pakistan's landmark elections after millions of people defied deadly Taliban attacks to take part in an historic democratic transition in the nuclear-armed state.

Polling stations officially closed at 6:00 pm (1300 GMT) after a "huge turnout" in Punjab, the biggest province, capping a dramatic day that saw bomb attacks kill 12 in Karachi and gunmen shoot dead six in the southwest.

The main issues are the tanking economy, an appalling energy crisis that causes power cuts of up to 20 hours a day, the alliance in the US-led war on Islamist militants, chronic corruption and the dire need for development.

More than 86 million people were eligible to vote at 70,000 polling stations for the 342-member national assembly and four provincial assemblies in Khyber Pakhtunkhwa, Punjab, Sindh and Baluchistan.

It marks the first time that an elected civilian administration has completed a full term and handed power to another through the ballot box in a country where there have been three military coups and four military rulers.

The front-runner is ex-prime minister Nawaz Sharif, head of the centre-right Pakistan Muslim League-N (PML-N), but much of the campaign has been electrified by cricket star Imran Khan with promises of reform and an end to corruption.

Sharif voted in Lahore, driven in a bulletproof vehicle and greeted with roars of "long live the lion" from supporters using his nickname.

"I am confident that tonight we will start receiving good news from across the country," Sharif told reporters after casting his vote.

There were festive scenes in Lahore where cars, motorbikes and rickshaws festooned with party banners blared out music, while voters draped in flags shouted slogans, an AFP reporter said.

"We're really enjoying this moment -- people are very much happy about the chance to have change," said Rashid Saleem Butt, 50.

Earlier, queues formed outside polling stations in Pakistan's main cities where people spoke enthusiastically about exercising their democratic right and voting for change, although some people expressed nervousness about security.

"People have been up all night, actually I haven't slept, a lot of my friends haven't slept. People just wanted to come out and do this, because we never had this chance," said Natasha Ejaz, a singer, in Islamabad.

Voting in Pakistan's financial hub Karachi was marred by allegations of rigging from rival parties, while the Taliban targeted a candidate for the Awami National Party (ANP), an ally of the outgoing government.

The target, Amanullah Mehsud, escaped unhurt, police said, but 11 other people were killed, including a small child, and around 40 people wounded.

Another person was killed and three wounded when a low-intensity bomb exploded in a bus elsewhere in the city.

Islamist party Jamaat-e-Islami boycotted polls in Karachi after accusing the Muttahida Qaumi Movement (MQM), which controls the city, of fraud and violence.

The MQM, which itself boycotted a stronghold of the rival Pakistan People's Party (PPP) in Karachi, denied the allegations.

The election commission raised concerns about threats to its staff in the port city, which it says has prevented them from performing their duties, but the organisation was quick to praise the polls as voting ended.

"The election commission of Pakistan was successful in conducting the elections. We have a huge turnout in Punjab," commission secretary Ishtiaq Ahmed told a news conference in Islamabad.

Ahmed stopped short of announcing a precise turnout figure, but said that it was "very good".

Voting was extended by three hours to 1500 GMT in seven Karachi constituencies to compensate for a delay in opening the polling stations.

Nadir Hassan, 29, said: "I came to vote at 7:45 am and waited until 1pm before leaving. First they said they had no papers, then no ballot box, then no ink."

Analyst Imtiaz Gul said he believed high turnout was due to Khan galvanising millions of first-time voters, although he cautioned that it may not necessarily translate into seats.

More than 600,000 security personnel deployed to protect the vote and Pakistan sealed its border with Afghanistan and Iran to boost security after pre-election violence killed at least 127 people, according to an AFP tally.

In North Waziristan, a notorious Taliban stronghold, mosque loudspeakers announced that no woman would be allowed to leave their home to vote, according to local residents. Women's turnout is traditionally low in conservative areas.

The outgoing centre-left PPP ran a lacklustre campaign, with its chairman Bilawal Bhutto Zardari too young to run and hounded by security threats.

With no reliable polling data, Sharif has been earmarked the most probable winner, but if PTI do well enough to become a formidable opposition, there are concerns that the emergent coalition will be weak and possibly short-lived.

Sharif served as prime minister from 1990-93, when he was sacked for corruption, and from 1997-99, when he was deposed by the military, although his family say he is a changed man who will this time govern more successfully.