A heroic nurse saved the life of a 7-year-old girl trapped in a massive Upper West Side high-rise blaze — which started when a woman’s bathrobe caught fire while she was wrapping Christmas gifts, FDNY officials said Friday.

The nurse, who officials did not identify, administered CPR to the little girl, who was unconscious and in cardiac arrest on the 25th floor. The health-care worker then called for help in the fire, which broke out Thursday evening at West 59th Street and 10th Avenue.

“I believe the nurse should be given a lot of credit for what she did prior to our members arriving,” said FDNY Assistant Chief Roger Sakowich. “Then our members did assist and then actually carried the child down the steps to the ambulance.”

The 33-story building is owned by Mount Sinai West and houses mostly doctors and hospital staff across 460 apartments.

The fire broke out around 5 p.m. inside a third-floor apartment, where a woman’s bathrobe caught fire by candles lit in her living room as she wrapped Christmas presents. She also had lit candles in the bedroom.

“She removed the clothing, and she threw that on the couch, I believe, and left the apartment,” said Sakowich. “In doing so, she left the door open.”

Soon after, a responding firefighter reached the floor — but couldn’t shut the door to the apartment to contain the fire.

“He was trying to close the door and he experienced an extreme amount of heat and had to back out of the hallway,” Sakowich said.

The blaze quickly spread to the fourth floor with thick, black smoke filling the entire building.

“The biggest problem we had was the door being left open and the amount of fire … that got out into the hallway and up into the building,” said Sakowich.

The apartment where the blaze broke out had a smoke detector — but it wasn’t working.

The home was “gutted” as a result, fire officials said at the scene.

Sakowich said the woman could’ve thrown the bathrobe into the bathtub to extinguish the flames but “she was burnt.”

He couldn’t give an update on the woman’s current condition.

In total, 27 people were injured, including four firefighters who were hospitalized. Most suffered smoke inhalation and all are expected to survive – including the 7-year-old.

“A number of occupants of the building presented to our emergency departments and other area hospitals with varying degrees of injury,” said Renatt Brodsky, spokesman for the Mount Sinai Health System. “Most of those patients have been treated and released. We are working closely with city agencies.”

Leah Currie was home at her 10th floor apartment at the time with her children, ages five weeks and 18 months. Her husband, David, a physician, was at work.

“My friend was visiting me. We were just scared, so scared. There’s a fire going on and we couldn’t exit,” said Leah. “We were trapped on the 10th floor with two kids. Luckily they took care of it quick enough. The firefighters came up and helped us take the babies out.”