As roaring flames consumed an apartment building in New York City early Thursday, a firefighter dangling from a rope plucked a trapped person from a window on the fifth floor and safely lowered him to the ground.

Firefighter Jim Lee told reporters at the scene that the rope that colleagues had used to drop him from the roof burned through just 15 seconds after he touched the earth.

"I told him to stay calm and when we got down, I said, 'I hope you enjoyed the ride,'" Lee said. "He sort of smiled and he was thankful."

The overnight blaze at the building on Manhattan's Upper East Side killed one person, officials said. Five tenants were injured, one seriously.

The fire was reported around 3:30 a.m. in a building on East 93rd Street in the Yorkville neighborhood. Flames quickly spread throughout the building and, at one point, were shooting out the roof, sending burning embers onto nearby buildings.

Some residents of the burning building fled into the streets in their pajamas.

Officials don't yet know where the fire started. Seven firefighters were hurt during the response.

Firefighters had extinguished the blaze by early Thursday morning.