The train, which was transporting grain, crashed in Ecatepec, a large municipality in the State of Mexico that forms part of the urban sprawl extending from the capital.
After the train ran off the tracks shortly before 6 a.m., one of its cars careened into a residential area, killing five people, the Communications and Transportation Ministry said in a statement.
Authorities are removing debris and more victims will probably be found, the State of Mexico prosecutor's office said.
The train belonged to Kansas City Southern's Mexican unit, the ministry said.
In a statement, railroad and terminals operator Ferrovalle, which is part owned by Kansas City Southern de Mexico, lamented the accident, the causes of which were still unknown.
The Mexican regulator for railway transport will investigate the accident, the ministry said.
"The government of Ecatepec sends its deepest condolences to the families of the victims and reiterates its support in this difficult moment," Mayor Indalecio Rios wrote on Twitter.
(Reporting by Lizbeth Diaz and Julia Love; Editing by Lisa Von Ahn and Peter Cooney)
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)