Aaron Alexis, 34, went on the shooting spree with an assault rifle and a 9mm gun after he got into the secure facility in Washington DC, which houses 3000 workers, using another worker's identity card.
Alexis, of Fort Worth, Texas, also died in the incident. He served full-time in the Reserve from May 2007 to January 2011, but had been arrested on firearms charges before leaving. It was unclear if he was now a contractor for the Navy or how he obtained the card.
The local community and the nearby US Senate building and its offices were locked down as searches continued following reports another gunman wearing military-style clothing was inside the vast military complex.
A police officer was shot in a gunfight with Alexis. He was last night receiving surgery, but said to be responding well. At least two women were also caught up in the shooting.
The FBI has yet to rule out a terrorism motive, but it was not immediately clear what drove Alexis to target the base.
Vincent Gray, Washington DC's mayor, told a news conference: "This is the most horrific tragedy for our city."
He added that in addition to the victims, "there are probably a dozen or more who are wounded."
Washington Navy Yard is based in one of the service's oldest buildings and handles submarine activity a short distance from the White House and Capitol.
For Barack Obama, it was yet another mass shooting he has had to mourn during his presidency. Recent gun rampages include the shootings at a cinema in Aurora, Colorado, cinema in 2012 left 12 dead. Last December, a gunman killed 20 children and six adults at Sandy Hook Elementary School in Connecticut.
Obama told the nation on TV: "We still don't know all the facts. But we do know that several people have been shot, and some have been killed.
"So we are confronting yet another mass shooting. And today it happened on a military installation in our nation's capital. It's a shooting that targeted our military and civilian personnel."
Witnesses described a gunman opening fire from a fourth-floor overlook, aiming down on people in the first-floor cafeteria.
Others said they were shot at from a hallway Todd Brundidge, an executive assistant with Navy Sea Systems Command, said the gunman was wearing blue overalls.
He said: "He just turned and started firing."
Colleague Terrie Durham added: "He aimed high and missed. He said nothing. As soon as I realised he was shooting, we just said, 'Get out of the building."'
Patricia Ward was in in the cafeteria getting breakfast when she heard "three gunshots straight in a row - pop, pop, pop." She added: "Three seconds later, it was pop, pop, pop, pop, pop, so it was like about a total of seven gunshots, and we just started running."