He also shot at police before running away.
The gunman threw down his gun and surrendered at a nearby Mexican restaurant after running out of ammunition, said San Francisco Police Chief Greg Suhr.
“We do not know at this time what the motive for this horrendous crime was,” Suhr said. Police initially thought there had been a robbery at the Gift Center and Jewelry Mart.
The gunman also carried a knife but police did not say whether the victims were shot or stabbed.