The first emergency call came at 6:51 p.m. for a fire in a five-story apartment building at 2363 Prospect Avenue in the Belmont neighborhood, a spokesman for the New York City Fire Department said. The department responded in three minutes, the mayor said, and firefighters were able to rescue 12 people.

The fire began on the first floor but quickly spread throughout the building, as the wind fed oxygen to the flames. The people who died were on various floors, the fire commissioner, Daniel A. Nigro, said.

The blaze grew to five-alarm status, and more than 160 firefighters responded. By the time Mr. de Blasio spoke, around 10 p.m., the flames had been brought under control.

The cause of the fire was not yet clear.

It was a bitterly cold night, with temperatures in the teens, and the wind chill made it feel below zero. Water leaking from fire hoses froze in streaks on the concrete, and displaced residents walked around draped in American Red Cross blankets. Three young girls were whisked into a neighboring building after climbing down a fire escape with no shoes or coats.

Officials said they were opening up the nearby Grace H. Dodge vocational high school as a reception center for people who needed housing and other services. People looking for relatives who lived in the building were also told to go to the school, or to call 311.