Fire marshals said the cause of the blaze at 530 45th St. was electrical and that a smoke alarm was not present.
Twelve units and 60 firefighters reached the three-story building in just over three minutes.
One firefighter rescued a child on the second floor and others rescued tenants on the third floor.
No firefighters were hurt.
FDNY Assistant Chief of Fire Operations Michael Gala said at the scene that the blaze was under control by 12:08 a.m., about 45 minutes after it began.
“Some of the victims were sheltered in the rear yard as our units were extinguishing the fire and several occupants of the building fled to the buildings next door,” Gala said.
Family members and friends of the displaced residents have set up a GoFundMe page at https://bit.ly/3a4dN2S.