Police responded to a call reporting a man with a knife near the intersection of 22nd and Iowa streets, police Officer Gordon Shyy said.
The man in his 20s was not compliant with officers and climbed onto a ledge, prompting police to shut down the area, including Caltrain service.
Shortly before 6 p.m. police said hostage negotiators had talked the man off of the ledge.
Caltrain spokeswoman Christine Dunn said Caltrain tracks through San Francisco reopened shortly after 6 p.m. but that service delays will continue for some time.
Some northbound trains carried riders to the Millbrae station, where they could take BART. Caltrain tickets are being honored on BART this evening.