Unrest in Pakistan's biggest city Karachi has marred landmark national and provincial polls.
Pakistan's election commission said it had been unable to carry out "free and fair" polls in Karachi and that voting would be re-run in some areas.
In the worst election-day violence, 11 people were killed in the bombing of a political office in the city.
The vote marks Pakistan's first transition from one civilian government to another in its 66-year history.
Voting was extended for an hour across the country before closing at 18:00 (13:00 GMT). Counting has now begun in some areas.
But polls are expected to remain open for three hours in seven constituencies in Karachi where voting was delayed because ballot boxes and papers had not arrived on time.
"At my polling station, the gates have remained closed all day. We have not been able to vote and the crowd outside is huge," Karachi resident Nishat Aleem Khan told the BBC.
Pakistan's election commission said it was "investigating reports of threats made to election officials" and that there would be "no compromise" on the fairness of the poll.
It ordered a halt to voting in 42 stations in Karachi's NA-250 constituency and said the poll there would have to be re-run.
Turnout is believed to have been high. An election commission spokesman said they hoped for a figure of 60-80%.
The turnout in 2008 was 44%.
The Pakistani Taliban have threatened to carry out suicide attacks.
About two hours after polling started, a bomb attack was reported in Karachi, apparently targeting an Awami National Party (ANP) candidate outside the party's political office.
Eleven people were killed and more than 40 others were wounded, police told BBC News. Local ANP candidate Amanullah Mahsud was injured but not seriously.
The attack happened in the Landhi district of Karachi, which known for Taliban activity. Another ANP candidate and his son were shot dead close to the area last week.
Sporadic violence linked to the election was reported in several other areas of the country.
- Seven people were hurt outside a polling station in the north-western city of Peshawar when a bomb went off attached to a motorcycle
- A suicide bomber blew himself up after police prevented him from entering another polling station in Peshawar, police told AFP
- A clash between two groups at a polling station in Chaman on the border with Afghanistan left least three people dead and several others hurt
- An explosion was also reported in Quetta in the south-west
- At least four people were hurt in a blast in Mardan in the north-west
The Taliban have been blamed for numerous attacks throughout the campaign on Pakistan's three most prominent liberal parties.
The Pakistan People's Party (PPP) along with the Karachi-based Muttahida Quami Movement (MQM) and the ANP have been singled out for threats, and were forced to curtail their campaigning as a result.
Militants have so far avoided targeting the campaigns of Pakistan Muslim League-Nawaz (PML-N) of Nawaz Sharif and the Tehreek-e-Insaf (Movement for Justice) party of Imran Khan, who is recovering in hospital after a fall at a party rally.
Pakistan's election commission said in a press conference that two ballot boxes had been stolen in Punjab and that they could be "accounted for".
Whichever party ends up winning the election, it has been a bad day for the Taliban, the BBC's Owen Bennett Jones reports from Lahore.
The Taliban had threatened a bombing campaign to disrupt the electoral process but tens of millions of Pakistanis defied the jihadis and cast their ballots in a good-natured and at times joyous atmosphere, he adds.
'We want change'
Tens of thousands of troops had been deployed at polling stations to ensure security.
In the run-up to the election, more than 100 people died in election-related violence. Before polls opened, Pakistan sealed its borders with Iran and Afghanistan in an effort to keep foreign militants at bay.
Officials said the borders would remain closed for the next three days.
Queues started forming before polling stations opened at 08:00 (03:00 GMT) on Saturday.
Abdul Sattar, 74, said: "We want change, we are really fed up with old faces coming back to power every time and doing nothing for the nation."
While the streets of Islamabad were largely deserted, areas around polling stations were described as filled with crowds.
At a polling station on the outskirts of the capital, BBC World Affairs correspondent Mike Wooldridge said around 1,000 of the 4,000 registered voters had cast their ballots by midday, including a large proportion of women.
The BBC's Saba Eitizaz in Peshawar reported long queues of women, with many first-time voters.
Right-wing religious party Jamaat-e-Islami complained that some of its voters had been harassed and announced it was boycotting the vote in Karachi and areas of Hyderabad, reports said.
Mr Sharif, who was deposed as prime minister in a military coup 14 years ago, is seen as favourite to return for a third term of office.
As he voted in Lahore, the former PM said he was hopeful of victory.