Trapped by fire and choking on thick smoke, Phyliss Terrell stuck her head out the window of her third-floor apartment on Minnesota Avenue in Southeast Washington. She was about to jump.

Just then, Truck 7 from a station at Eastern Market pulled up. Danny Lovato, an 11-year veteran, grabbed a ladder and threw it against the red brick wall. He climbed to nearly the top rung, but found it too dangerous to pull the 64-year-old woman out.

So Lovato, 39, pulled off his breathing mask and put it on Terrell’s face, sacrificing the air from the tank on his back. They stayed like that for several minutes, until other firefighters could reach the woman from the inside. A photo making the rounds on social media shows Lovato’s torso on the ladder, his head engulfed in a cloud of toxic smoke.

“He took a beating to protect that woman,” said Ed Smith, president of the firefighters union.

Terrell’s son-in-law, Robert Thornton, said Terrell, who he calls mother, “is so grateful that she can’t stop crying. . . . She can’t believe that he came up and got her. And I’m thankful that my mother is still here. If it wasn’t for that firefighter, my mother wouldn’t be here anymore.”

Lovato, who is married and has a 6-year-old son, and the woman were rushed to the burn unit at MedStar Washington Hospital Center, where both remained Thursday. The fire occurred about 4 p.m. Wednesday.

Terrell, who works at the federal Office of Personnel Management, has been alert and talking and is expected to recover. She was listed in serious condition on Thursday. Thornton, 55, said the fire started in a furnace in an apartment next to his mother’s.

The firefighters, Thornton said, “do jobs that we can’t do. . . . I’m sorry that one got hurt in this, but I thank him so much.”

Lovato suffered smoke inhalation and internal injuries from the toxic smoke, and was sedated and intubated until Thursday afternoon. He was listed in fair condition. Jeffrey Shupp, director of the hospital’s burn center, said Lovato had some swelling in his airways and soot that doctors were able to suction out. He said the firefighter could be home by Friday. “He was very lucky,” Shupp said.

D.C. Fire and Emergency Medical Services Department Chief Gregory M. Dean met with the rescuer and the rescued on Thursday. “Lovato told me he was just doing his job,” Dean said. “The woman was concerned about him.” Dean said Terrell, from her hospital room across the hall from Lovato’s, chatted with his wife, Adrienne, and asked her, “Why would someone risk their life for someone else?”

Several D.C. police officers also helped get people out of the burning apartment, and another firefighter was injured in the blaze. A cause has not yet been determined.

Jason Woods, president of the nonprofit D.C. Firefighters Burn Foundation and a firefighter assigned to the District’s Rescue 1 unit, said he also talked to the trapped woman, who told him she “was seconds away from jumping out of that window.

It’s not just the smoke that is so dangerous, but the toxic gases that can singe internal organs. “Danny was very lucky,” said Woods, a 16-year veteran whose foundation helps firefighters and families who suffer burns. “It could have been a lot worse for both of them.”