An armed man shot and killed a male hostage and then himself in a standoff with police at a building at Nasa's Johnson Space Centre in Houston, Texas, police said on Friday.
Nasa and police identified the attacker as William Phillips, 60, a Nasa contract worker. Police said he had an apparent dispute with the killed hostage.
Nasa named the dead hostage as David Beverly, a civil servant who worked for the agency. Beverly was shot in the chest and probably died "in the early minutes of the whole ordeal," police said.
A female hostage, identified as Fran Crenshaw, escaped after being bound to a chair with tape.
The incident began at about 1:40pm CDT (1840 GMT) when Phillips went into a building carrying a gun and was heard to fire at least two shots.
Workers evacuated the building and heavily armed police moved in.
As they approached, they heard a shot and went in to find the dead bodies of two men, said Dwayne Ready, Houston police department spokesman.
He said: "As our Swat members made entry, they did indeed determine that the suspect shot himself one time to the head.
"Also, on the same floor there was one other hostage that was shot. We believe that may have occurred in the early minutes of this whole ordeal."
A Nasa spokesman said the agency would review its security after the incident.
"Any organisation would take a good, hard look at the kind of review process we have with people," Doug Peterson said.
John Prosser, executive vice president of Jacobs Engineering, confirmed that Phillips was a company employee, but declined to release any information about him.
Jacobs provides engineering work for the space agency and conducts research and development for new space technologies.
Building 44, where the shooting took place, is separated from most of the space centre, which is on a 1,600-acre campus.
The campus is home to Nasa's mission control and the training centre for the space agency's astronaut corps.
Nasa officials said the incident was not affecting operations, which include flight control for the International Space Station.
Mike Coats, the director of the Johnson Space Centre, said Phillips had worked for Nasa for 12 to 13 years.
He said "up until recently, he has been a good employee".
Harold Hurtt, a police chief, said there was apparently a dispute between Phillips and Beverly.
Beverly's wife said her husband had mentioned Phillips to her before, but she declined to elaborate, saying it would not be fair to Phillips.
George Bush, the US president, was informed about the attack as he flew back to Washington from an event in Michigan, said Dana Perino, a White House spokeswoman.