The fire was reported at 1:06 p.m. at 2300 Third St., located on the southwest corner of Third and 20th streets.
It started in a one-story building along Third Street and spread to the eaves of an adjacent two-story building on the same property, fire department spokeswoman Mindy Talmadge said.
Talmadge said the blaze may have started on the one-story building's exterior.
She said there is a "history of problems with squatters in the building," but added that "we don't know if that was the case today."
The buildings' terra cotta roofs made the blaze difficult to extinguish, Talmadge said.
An employee at the Dogpatch Cafi and Gallery said he had not seen any recent evidence of squatters or trespassers in the neighborhood.
San Francisco police Capt. Paul Chignell, of the department's Bayview Station, was at the scene this afternoon. He said the fire burned at a former police station that has been vacant for 16 years.
San Francisco police Officer Ivan Sequeira said the former police station was built around the turn of the century and cannot be demolished due to its historical significance.
"Over the years we have had to board it up to prevent people from stealing copper. Underneath the terra cotta roof it's all copper," Sequeira said, pointing out the last ornate copper drainpipe still intact on the building's exterior.
The buildings' ground floor windows were previously boarded up and additional grating has been added. The building also has barbed wire fencing surrounding the driveway to protect the property from potential trespassers.
"It's a beautiful building," Sequeira said, adding that although the building remains vacant, it continues to cost the city money to maintain.
No injuries were reported, and the cause of the fire has not been determined.
Service was briefly disrupted on San Francisco Municipal Railway's T-Third line as firefighters battled the blaze, but service resumed at about 2:15 p.m.