The two-alarm fire was reported at 6:13 p.m. Monday at a seven-story building at 601 O'Farrell St.
It took firefighters more than three hours to extinguish the blaze, and they eventually got it under control at 9:54 p.m., fire spokeswoman Mindy Talmadge.
The fire was apparently caused by a plumber who was using a torch to solder a pipe on the second floor, Talmadge said. The flame spread upward through the pipe all the way to the fifth floor, she said.
No one was injured in the blaze, which caused an estimated $1 million in damage to the building itself and $250,000 in damage to its contents. Twelve apartments were damaged, she said.