Rescue operations were made more difficult as the drug rehabilitation unit's windows were barred and an exit at one end of the building was locked, Russian officials said.
Yevgeny Bobylyov, a spokesman for the city fire department, said the victims died of asphyxiation. Ten other people were hospitalised for carbon monoxide poisoning.
ITAR-Tass said that the area of the fire was comparatively small, about 100 square meters, but that people had died from the heavy concentration of smoke.
Bobylyov said that the first call to the fire department, which was made at 1.30 am (22.30 GMT Saturday), had come very late.
He said: "The hospital personnel worked very badly, they did not take steps to evacuate people in the early stages of the fire."
He said firefighters put out the fire within an hour of the first call for help.
Firefighters used 20 fire engines to extinguish the fire in a two-hour operation.
News agencies reported that two hospital staff members were among the dead but there were differences in the number of casualties reported.
The fire was reported as the worst fire to break out in Moscow in three years.