Firefighters rescued at least 15 people, including a 6-year-old boy who was dropped from a third-floor window of a large apartment building in the city's Roxbury neighborhood.
Mohamed Abdul Jabar, 28, of Medford, was arrested after he showed up at Boston Medical Center with burns and claimed he started the fire, police said.
Jabar was transferred to the burn unit at Massachusetts General Hospital, where he was being treated in intensive care with second-degree burns to his arms, hands and face. His injuries don't appear to be life-threatening, police said.
Police spokeswoman Elaine Driscoll said a preliminary investigation indicates that Jabar set the fire as part of a failed suicide attempt.
Jabar is expected to face a list of charges, including arson and attempted murder.
Ten people were taken to the hospital, most with smoke inhalation. Two firefighters and a police officer were treated for minor injuries.
Herbert and Judith Lamb were forced to drop their 6-year-old grandson from the window of their third-floor apartment into the arms of a waiting firefighter.
"Thank God I caught him. I've never had to do that before, and I hope I never have to do it again," Boston Fire Lt. Glenn McGillivray told The Boston Globe. He said firefighters knew Judith Lamb wouldn't be able to hold on to the child until more help arrived, so they told her to drop him. Then they used a ladder to rescue her.
Residents who escaped said they heard an explosion at about 1 a.m.
A short time later, a man showed up at Boston Medical Center with burns and said he started the blaze, Fire Department spokesman Steve MacDonald told The Associated Press. Police said Jabar does not live in the building, but may have been in a relative's apartment.
MacDonald said the windows and frame were blown out in one corner of the building and bricks littered the street. More than two dozen apartments were damaged or destroyed.
All residents were accounted for, firefighters said.
About 160 firefighters were called to the scene. A temporary shelter was set up for residents displaced by the fire.