The fire, located at a three-story building at 119 Broad St., between Capitol and Plymouth avenues, was reported to fire officials at 5:31 a.m.
Firefighters battled the blaze on the second floor of the building and were able to bring the fire under control at 6:14 a.m.
Fire officials said that 25 residents were evacuated, no injuries were reported and the cause of the fire remains under investigation.
The American Red Cross responded to the scene to assist those residents displaced by the fire.
The fire has caused the Muni M-Ocean View line to be rerouted via the KT line with shuttles to West Portal, according to the SFMTA.