District prosecutor Alberto Ramos said three were killed yesterday at the scene and gave no more details. Paramedic Fernando Ochoa said a fourth person died later in the hospital.
Witnesses said the shooting happened in the Body Extreme gym in Tepito, one of Mexico City's most dangerous neighborhoods.
Ochoa said the shooting appeared targeted and the gunmen shot several rounds.
"It looks at like that attack was directed at them," he said.
Josefina Ramirez said her nephew was one of the four killed, along with two friends and an instructor. "Two masked men came and just started shooting," she said. "He had no enemies."
More From This Section
The neighborhood is home to 12 people who were kidnapped nearly two weeks ago from an after-hours bar in the city center. Three people have been detained in the kidnapping, but there is still no sign of the 12 who were taken in broad daylight May 26 by heavily armed and masked men.
It was not immediately clear if the shooting yesterday had anything to do with the kidnapping.
But the disappearance of the 12 has been linked to a murder on May 24 outside another Mexico City bar, according one public security official who was not authorised to speak on the record.
The shooting yesterday so close to the two other crimes raised fears that an organized crime battle could be breaking out in Mexico's capital, which has been mostly spared from the cartel wars that have caused so much violence along the US-Mexico border and in other parts of the country.
The shooting brought an enormous police operation, including helicopters flying over the mostly residential street.
One woman crying at the scene said her boyfriend was killed, but wouldn't give her name, only claiming his innocence and shouting "you know who did this.