The completion of the election was plenty to celebrate for some voters
US President Barack Obama has hailed a "milestone" in the history of Iraq, as it completed its second parliamentary election since the 2003 invasion.
He praised the courage of voters who turned out despite bomb and mortar attacks that killed at least 35 people.
Two buildings were destroyed in Baghdad, while there were also attacks in Mosul, Falluja, Baquba and Samarra.
"Today's voting makes it clear that the future of Iraq belongs to the people of Iraq," Mr Obama said.
"Today, in the face of violence from those who would only destroy, Iraqis took a step forward in the hard work of building up their country."
Mr Obama repeated his vow to withdraw US combat troops from Iraq by the end of August, and all the remaining US forces by the end of next year.
A huge security operation was mounted, involving more than 500,000 Iraqi security personnel.
The border with Iran was closed, thousands of troops were deployed, and vehicles were banned from roads.
Still, the first wave of attacks came early in the day. In Baghdad, dozens of mortar shells rained down on several neighbourhoods.
Other cities also came under mortar and grenade attack.
And the worst damage was caused by bomb attacks that destroyed two blocks of flats in the capital. Twenty-five people were killed in one of the blasts in the north of the city.
The BBC's world affairs editor John Simpson described how rescue workers removed the rubble with their hands and basic equipment, and how they managed to bring one woman out alive.
Role for Sunnis?
Barack Obama praises Iraqi people
Iraqi Prime Minister Nouri Maliki said the attacks "are only noise to impress voters - but Iraqis are a people who love challenges and you will see that this will not damage their morale".
He had called on voters to turn out in large numbers, saying participation would boost democracy.
"I urge all politicians to accept the results," he said. "He who wins today may lose tomorrow and he who loses today may win tomorrow."
But one of his main rivals, Iyad Allawi, has already criticised election organisers, accusing them of lax procedures, and demanded an investigation by the new parliament.
"There was major confusion inside and outside Iraq in the voting centres and that leaves a question mark over the [electoral commission's] role," said Mr Allawi.
IRAQI GENERAL ELECTION
Voting to elect 325-member parliament.
About 19 million eligible voters out of 28 million
Around 6,200 candidates from 86 factions competing
200,000 security personnel on duty in Baghdad
Key issues: Security, services and disqualification of alleged Baathists
Previous votes: Jan 2005 (transitional national assembly), Oct 2005 (constitution), Dec 2005 first post-invasion parliament, Feb 2009 (local elections)
Correspondents say Prime Minister Maliki looks likely to retain power at the head of his Shia-led coalition.
The key will be whether Mr Maliki can bring Iraq's embittered Sunni minority into his government and make them feel they have a stake in Iraq's political future again.
Queues were reported at polling stations in Sunni areas of the country, where many people in 2005 decided not to vote.
Candidates from 86 factions were vying for 325 parliamentary seats, with some 19 million Iraqis eligible to vote.
Some 50,000 polling stations were in operation across the country. The electoral commission said despite the violence, only two of them had to be closed for short periods due to security concerns.
In Azamiyah in northern Baghdad, Walid Abid, 40, cast his vote to the crumple of mortars exploding not far away.
"I am not scared and I am not going to stay put at home," said the father-of-two.
"Until when? We need to change things. If I stay home and not come to vote, Azamiyah will get worse," Associated Press news agency quoted him as saying.
The BBC's Gabriel Gatehouse reports from a polling station in Baghdad