Police said gunmen burst into the Roosevelt Hospital in Guatemala City to rescue a jailed gang member who had been transferred there for a medical appointment.
The shooters were members of the Salvatrucha gang, one of the most notorious bands terrorizing Central America.
The attackers arrived in a car and took away fellow gang member Anderson Daniel Cabrera, 29, who had been jailed for murder, said officials who asked not to be named.
Two prison guards, two hospital workers, two children and another adult were killed, officials said.
Guatemala's President Jimmy Morales condemned the attack.
"The head-on fight against organized crime is our government's priority," he said in an address.
National police chief Nery Ramos said officers caught five gang members involved in the attack, but the convict had not been found.
Witness Elena De Leon sobbed as she told how she and her daughter were at the hospital for an appointment when the attackers struck. They escaped unharmed.
"I am very worried and tired of what is happening in Guatemala", she AFP.
"People are right to feel angry and annoyed, and not to trust public officials."
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)