Formal and final results may take one or two days, but a forceful voter rebuke to the president, a close U.S. ally, could have broad repercussions for Pakistan's role in confronting the Taliban and Al Qaeda.
Unofficial tallies suggested that two of the president's closest allies lost what were considered bellwether races.
One was former Cabinet minister Sheikh Rashid Ahmed, who conceded in his district in Rawalpindi, outside the capital. The party president of the ruling Pakistan Muslim League-Q, Chaudhry Shujaat Hussain, also appeared to have lost his seat in Punjab, the country's most populous and politically influential province.
In contrast, the Pakistan People's Party, or PPP, of assassinated former Prime Minister Benazir Bhutto appeared to have performed strongly, particularly in her native Sindh province, along with the Pakistan Muslim League-N of former Prime Minister Nawaz Sharif, which appeared poised to take Punjab.
Drum-beating celebrations broke out before dawn in cities including Karachi and Rawalpindi. Supporters of the two main opposition parties danced in the streets and waved party and Pakistani flags, while the headquarters of ruling party candidates were dark and silent.
Private Pakistani TV stations said that by midmorning today, unofficial tallies had been compiled for about two-thirds of the 272 parliamentary seats being contested.
Geo television said Sharif's party had edged out Bhutto's, with the two main opposition parties garnering more than 60% of the vote between them. The pro-Musharraf party trailed with about 12%.
Reports suggested that turnout had hit a historic low, about 35%, according to Sarwar Bari of the nonprofit Free and Fair Elections Network. Many voters were kept away from the polls by fear of violence.
In addition to the nationwide vote for parliament, ballots were cast for regional assemblies. In a striking turnaround, an alliance of religious parties appeared to have lost control of the volatile North-West Frontier Province, a hot spot for fighting between government forces and Islamic militants.
Scattered election-related violence killed at least 24 people and injured scores of others, but the polls closed without a major attack.
The campaign had been scarred by a series of suicide bombings, including the assault that killed Bhutto on Dec. 27.
Public opinion surveys taken before the election suggested that Bhutto's PPP would win the largest share of votes, followed by Sharif's party, with the Musharraf- allied ruling party trailing.
Despite fears of violence or vote-rigging, a slow and steady procession of Pakistanis trekked to polling stations throughout the day.
Turbaned tribal elders, urban sophisticates in designer sunglasses and sinewy laborers wearing dusty sandals emerged from polling stations with ink-stained thumbs and, in many cases, smiles of quiet satisfaction.
"My vote is a message to Musharraf -- that he should go," college student Adil Javed said.
The president, speaking on state television, said he would give "full cooperation" to whichever party won.
But an opposition-dominated parliament could move to impeach him, or to invalidate his controversial election to another term by lawmakers late last year.