Philadelphia firefighters battled for hours early Monday to contain a five-alarm blaze that burned through a four-story apartment building on a frigid morning in Overbrook, displacing more than 65 people.

Icy conditions and structural concerns posed challenges for the dozens of firefighters who responded to the massive blaze at the Overbrook Garden apartments, 63rd and Jefferson Streets. At least two firefighters needed treatment for minor injuries, officials said.

First reported at 2:16 a.m., the fire was declared under control at 7:57 a.m. Crews remained at the scene throughout the day to douse hot spots.

Forced out of the building because of structural issues, firefighters had to pour water on the blaze from ladders and snorkels above the structure in hope of preventing a full collapse.

With temperatures below freezing, firefighters had to contend with icy conditions, and commanders at the scene instituted a mandatory “rest and rehab” rotation so firefighters could warm up.

“A fire of this magnitude is always a challenge — the cold definitely complicates things,” Fire Commissioner Adam K. Thiel told reporters at the scene.

He said later that “five-alarm fires are fairly rare,” adding that the last one in the city was in May, when flames destroyed a four-story warehouse in North Philadelphia.

No injuries to residents were reported. The cause of the fire was under investigation.

Gas and electric services were turned off in the immediate area for hours Monday morning.

The Red Cross set up a temporary shelter at West Philadelphia High School for those who were displaced by the fire and had nowhere else to go.

Ketleen Dormeus, 66, said she was asleep in a neighboring house on 63rd when she was awakened by an acrid smell that stung her nose.

She went downstairs from her third-floor bedroom and found her residence filling with smoke.

“Oh, my God, my house is on fire,” she said she first thought to herself.

Dormeus awakened the five other people in her home, and they all evacuated into the bitter cold. Once outside, she immediately saw the massive fire just two doors away.

She spent some time on one of the SEPTA buses brought to the scene to shelter the evacuees but got off instead of being transported to a temporary warming center at Commodore John Barry Elementary School, 5900 Race St. She was able to return home around 11 a.m.

Valarie Watson was not so fortunate.

She was sleeping in her basement unit in the Overbrook Garden building when she was awakened by the fire alarm. She and most of the residents were able to flee safely. A few who needed assistance were taken out by firefighters, she said.

On Monday night, she was among several dozen residents spending the night in the auxiliary gym at West Philadelphia High School, 4901 Chestnut St.

“I’m doing one day at a time right now,” she said.

The fire began on the fourth floor, she said.

Arriving firefighters reported finding heavy fire on the top floor of the complex.

Firefighters went door-to-door to alert residents and later retreated from the building because of structural concerns after the roof collapsed.

The blaze escalated to a fifth alarm by 4:30 a.m., bringing 50 to 60 pieces of firefighting equipment and 200 firefighters to the scene.

The Red Cross and the city’s Office of Emergency Management first set up the warming center at Barry Elementary, where displaced residents were provided with meals. Neighborhood residents stopped by with clothing and food, said Dave Skutnik, spokesman for the Red Cross of Southeastern Pennsylvania.

Bob Myers, disaster services director for the Salvation Army, arrived at the fire scene around 3:30 a.m.

“The fire was through the roof of the building,” he recalled.

Myers was back Monday evening to help with providing aid to the firefighters still battling hot spots and to other responders.

Water was still being sprayed into the smoldering remains. The smell of smoke still lingered.

Officials said the Salvation Army, Red Cross, and other agencies would continue to work with those affected by the blaze.

Skutnik said Red Cross and OEM responders were interviewing the displaced residents to determine their needs, particularly in terms of shelter.

“We are trying to work out a longer-term solution,” he said.

The Red Paw Relief Team also was at the scene to assist pets affected by the fire. It said that five pets were reported missing and that three cats made it out. Two of the cats were staying with family and one was sent to a VCA Animal Hospital for temporary emergency shelter.