All were citizens of former Soviet nations in Central Asia, spokesman Sergei Vlasov said.
Several million migrants from Tajikistan, Uzbekistan and Kyrgyzstan have come to Moscow in search of work. Many have found jobs in construction or at the city's sprawling markets, which sell everything from clothes to construction materials.
Vlasov said the fire that broke out at the Kachalovsky market at 5 a.m. Tuesday tore through an insulated metal shed where the workers slept on bunk beds. The roof collapsed during the blaze, which burned for more than two hours, he said.
Investigators were still determining the cause of the fire, but said they suspected it may have started with electric space heaters. A light snow had fallen overnight.
Sergei Gorbunov, the fire department chief in Moscow's southeast district, told Russian television that workers were unable to exit through the one door connecting their living quarters with an adjacent storage hangar. He did not say why.
Television footage showed that the windows of the blue metal shed were barred and firefighters had pulled away strips of metal sheeting from one wall.
Russia has a poor fire safety record. About 12,000 people died last year in fires across the country.