Officers responded at about 6:40 p.m. to reports of a shooting at Capitol Avenue and Lobos Street, Officer Samson Chan said.
The victim was taken to San Francisco General Hospital, where he later died.
Police detained several suspects and recovered a gun at the scene, Chan said. A preliminary investigation revealed the attack appears to have been gang related.
Chan said officers were still on the scene as of 10 p.m. and planned to investigate throughout the night.