Four of the firefighters received minor injuries, the New York City Fire Department said, while one received serious but non life-threatening injuries.
A civilian also received minor injuries in the fire, which was reported after 12:30 a.m. on East 79th Street.
More than a 100 firefighters responded to the Upper East Side residence, the fire department said. The fire was under control by 2:30 a.m.
The cause of the fire remains under investigation.