Mayor Miguel Angel Mancera told Milenio television that three were killed, a woman and two men.
He earlier told the Televisa network that at least 54 people were injured, 22 of them children. Most of the injuries were relatively minor, he said, many caused by flying glass.
Fausto Lugo, the city's civil defense director, said 37 people were transported to other hospitals and he said other people were likely still buried in the rubble.
The explosion sent a column of smoke billowing over the area on the western edge of Mexico's capital and television images showed much of the hospital collapsed, with firefighters trying to extinguish fires. Mancera said the heaviest damage was near the hospital's loading dock.
Mancera said the blast apparently was caused by a leak in the hose carrying gas from the truck to the hospital, which is operated by the city.
"There was a super explosion and everything caught on fire," said Ismael Garcia, 27, who lives a block from the hospital.
Garcia ran toward the hospital where the truck had exploded and was told it had been connecting to the kitchen when the explosion occurred.
Garcia and others entered the hospital and made their way to the nursery. "Fortunately, we were able to get eight babies out," he said.
Borough chief Adrian Rubalcava said the injured were being taken to a nearby hospital, but the area had insufficient ambulances.
According to a government website, the hospital was founded in 1993 and counted 35 beds. It is located in a densely populated lower middle class neighborhood next to a school.
Copyright 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.