When the judge announced the sentence, Saddam appeared shaken.
However he soon recovered and shouted: "Allahu Akbar!" [God is greatest] and "Long live the nation!"
Saddam was found guilty by the Iraqi High Tribunal for ordering the killing of 148 Shia civilians in the town of Dujail in 1982.
The court said that he and his fellow defendants had ordered the villagers' murder after members of Dawa, a Shia political party, tried to kill Saddam in Dujail in 1982.
Saddam's sentence will be automatically appealed and reviewed by a panel of appeal judges, who will decide whether or not to allow a retrial.
If the judgement stands, however, Saddam must be executed within 30 days of the appeals panel delivering its verdict, which has to be ratified by Jalal Talibani, the Iraqi president.
Saddam, 69, said that he wants to be executed by firing squad. However Iraqi law states that he will be executed by hanging.
Saddam was the president of Iraq from 1979 to 2003, when his Sunni-dominated government was deposed by a US-led invasion.
Barzan al-Tikriti, Saddam's half-brother and the former head of the Iraqi secret police, and Awad Hamed Al-Bander, Saddam's chief judge, were also sentenced to death by hanging.
Saddam's 11-month trial was marked by theatrics by both his defence council and by Saddam and his seven co-defendants.
Shia in Najaf celebrated when they heard the court's verdict
Taha Yassin Ramdan, the former Iraqi vice president, was sentenced to life in prison.
The court also sentenced three of Saddam's co-defendants to 15 years in prison for their part in the Dujail killing and acquitted one minor Baath party official.
Ramsey Clark, Saddam's most outspoken American defender and a former US attorney general, was thrown out of the trial on Sunday and accused of insulting the people of Iraq.
Clark, a member of Saddam's defence team and a strident critic of the conduct of his trial, attended the start of the session but was ejected before Saddam was sentenced to death.
Raud Abdel Rahman, the judge, said: "Get him out of the hall. He came from America to ridicule the Iraqi people and ridicule the court."
Support and condemnation
Baghdad had been placed under a strict curfew in an attempt to halt violence following the verdict.
Iraq's government imposed a curfew ahead of the verdict
But despite the curfews, Shias gathered in Baghdad's Sadr City district to celebrate.
Around 1,000 people marched, waved flags, denounced Saddam and hailed the Shia cleric Moqtada al-Sadr.
"Deliver him to us, we'll execute him ourselves," shouted the crowd.
Thousand of Saddam's supporters, some of them firing wildly into the air, marched through his hometown of Tikrit, north of Baghdad.
"With our souls and our blood we redeem you, Saddam. Death to traitors and spies. Damn Bush and his agents. Yes, yes to the resistance. No option but to get rid of the occupier," chanted the crowd.
The Iraqi government also closed two Sunni television stations, accusing them of inciting violence after the verdict.
Abdel Karim Khalaf, an interior ministry spokesman, said: "We accept debates on any subject, but we do not tolerate television reports that encourage murder and violence."