All but one of the dead were soldiers, including a pregnant private who curled on the floor and pleaded for her unborn child's life. More than 30 other people were wounded.
The attack ended when Hasan was shot in the back. He is now paralyzed from the waist down and uses a wheelchair.
The military called nearly 90 witnesses at the trial and more during the sentencing phase. But Hasan rested his case without calling a single person to testify and made no closing argument. Even with his life at stake during the sentencing phase, he made no attempt to question witnesses and gave no final statement to jurors.
Hasan's civil attorney, John Galligan, said Wednesday that he believes Hasan received an unfair trial. Galligan said he was disappointed in the sentence and was confident it would be reversed on appeal.
Death sentences are unusual in the military, which has just five other prisoners on death row. Of 16 death sentences handed down by military juries in the last 30 years, 11 have been overturned, according to an academic study and court records. No American soldier has been executed since 1961.
Eduardo Caraveo, whose father was killed in the rampage, said he cared more about Hasan being convicted than about the sentencing. But he would have preferred that Hasan receive a life sentence.
"I didn't want him getting any satisfaction, so him getting killed by the government just gives him what he wanted. .... to be a martyr," said Caraveo, who lives in Tucson, Ariz. "My main thing is him being held accountable for his action. That's really all I ever wanted."
Authorities said Hasan spent weeks planning the Nov. 5, 2009, attack, including buying a handgun and videotaping a sales clerk showing him how to change the magazine.
He later plunked down $10 at a gun range outside Austin and asked for pointers on how to reload with speed and precision. An instructor said he told Hasan to practice while watching television or sitting on his couch with the lights off.