You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
The soldier, who was being treated for depression and anxiety, went to two buildings on the base and opened fire before he was confronted by military police, Fort Hood commanding officer Mark Milley said.
The gunman, whose motive remains unknown, then shot himself in the head with a .45-caliber pistol, he added.
"At this time there is no indication that this incident is related to terrorism," Milley told a news conference.
The rampage is the third shooting at a military base in the United States in about six months. It comes amid a broader national debate over the extent of gun control regulations after a series of shootings in public places, such as schools and malls.
Security officials said preliminary information identified the gunman as Ivan Lopez but Milley declined to identify the shooter, who is married, until his family was notified.
The suspect's wife was cooperating with law enforcement, a Federal Bureau of Investigation official said, according to CNN.
The shooter had served for four months in Iraq in 2011, Milley said, and was also undergoing evaluation for post-traumatic stress disorder.
The Scott & White Hospital in Temple, Texas, where some of the wounded were taken, said nine patients were in intensive care, three in critical condition. Other victims were taken to Fort Hood's Carl R. Darnall Army Medical Center, nearby where the shooting occurred.
U.S. President Barack Obama said he was "heartbroken" that another shooting had occurred at the Fort Hood Army base.
"We are going to get to the bottom of exactly what happened," Obama said. "We're heartbroken that something like this might have happened again."
The latest shooting at Fort Hood is throwing a spotlight on the U.S. military's so-far frustrated efforts to secure its bases from potential shooters, who increasingly appear to see the facilities as attractive targets.
The shooting started at about 4pm (local time) and put Fort Hood on immediate lockdown.
Milley said the shooter walked into one of the unit buildings, opened fire, then got into a vehicle and fired from there. He then went into another building and opened fire again, until he was engaged by Fort Hood law enforcement.
When confronted by a female military police officer, he killed himself with his semi-automatic weapon in the parking lot.
"He was approaching her at about 20 feet. He put his hands up, then reached under his jacket, pulled out the (.45) and she pulled out her weapon and then she engaged, and he then he put the weapon to his head," Milley said.
One of the buildings housed medical brigade day-to-day operations and the other, nearby, served the administration of the transportation battalion. All the killed and wounded were military personnel.
As soon as the shooting broke out, police secured the base perimeter, emergency vehicles rushed to the scene, helicopters circled Fort Hood and officers went from building to building searching for the shooter.
"We're camping out. ...The only guidance we've been given is to hunker down," a Fort Hood soldier who answered the phone at a building near the shooting told the Austin American-Statesman.
Central Texas College ordered an immediate evacuation of all students and staff and canceled classes at its Fort Hood campus.
"It's a terrible tragedy. We know that. We know there are casualties, both people killed and injured," Defense Secretary Chuck Hagel said.
The violence echoed the rampage of 2009, when a former Army psychiatrist shot dead 13 people and wounded 32 others in a shooting spree at Fort Hood, a base from where soldiers prepare to deploy to Iraq and Afghanistan.
Major Nidal Hasan shouted "Allahu Akbar," or "God is greatest" in Arabic, during the attack and later said he wanted to be a martyr. He was convicted and faces death by lethal injection.
In February, the U.S. military demolished the building where Hasan went on a shooting spree. It will plant trees, install a gazebo and mark the site with a remembrance plaque for the victims, the base said.
In September, a gunman opened fire at the Washington Navy Yard, killing 12 and wounding four before being slain by police. Last month, a civilian shot dead a sailor aboard a ship at a U.S. Navy base in Norfolk, Virginia.
Hagel, pressed about the military's so-far frustrated effort to secure its bases from potential shooters, said the latest incident at Fort Hood showed that there were problems that still needed to be addressed. The latest tragedy shows something is not working and needs to be fixed, he said.
Just last month, he ordered steps to improve Pentagon security after reviews found the Navy Yard shooting could have been averted if the gunman's mental health had been properly handled