Police responded to a report of a domestic dispute at an apartment building in the 1400 block of California Street, near Hyde Street, at about 6:30 p.m., Officer Carlos Manfredi said.
After just about four hours, the suspect, a man whose name was not released, surrendered peacefully, Manfredi said.
The incident began when a resident of the building overheard a domestic dispute between the man and a woman, Manfredi said.
Police attempted to make contact with the suspect upon arrival, but stepped back outside when they determined he might have had a weapon, Manfredi said.
"A tactical team was brought in when we heard there may have been a firearm, erring on the side of caution," he said.
Surrounding units were evacuated and nearby residents were told to shelter in place during the incident.
Neither the man, nor the woman, involved in the dispute appeared to be physically injured, Manfredi said.
Manfredi said the suspect may have been under the influence at the time of the dispute, but several hours had passed it was hard to determine.
A one-block radius of streets around the building were closed during the standoff, affecting service on the California Street cable car line between Hyde and Larkin streets, Manfredi said.
The streets were reopened at about 11 p.m., he said.
The man was detained on suspicion of domestic violence. The case is under investigation.