The drive-by shooting was reported around 3:30 a.m. in the 400 block of Mason Street in front of popular nightclub Ruby Skye, according to police.
The security guard was letting patrons out of the club when "he heard multiple gunshots and realized he was shot in the leg," police spokesman Officer Gordon Shyy said.
Shyy said witnesses spotted a blue convertible speeding away on southbound Mason Street immediately after the shots were fired, but that no further suspect description was available.
The guard, a 27-year-old man, was taken to San Francisco General Hospital to be treated for injuries that are not believed to be life-threatening, Shyy said.
The spokesman said police do not know whether the man was the shooter's intended target.
Anyone with information about this crime is asked to call San Francisco police at (415) 575-4444.