The suspect continued to shoot at police officers who arrived at the scene just after 2 p.m. According to the San Francisco Chronicle, the man surrendered after he ran out of ammunition.
Authorities originally didn't disclose any information about the suspect's possible motive.
"We don't know what relationship the suspect had to the victims," Police Chief Greg Suhr said, but added that the man had previously been seen in the building.
Police later identified 23-year-old Barry White as the suspect, the Contra Costa Times said. They added later that White didn't appear to have wanted to rob the store when he shot the victims.
Veronica Sirois, a shopper who heard the shooting, told the Chronicle that she heard "somebody yell, cry for help."
"Then I saw the SWAT. There was a dozen of them. They told us to lock ourselves in," she added.