Police said Lam then fatally shot himself in the head.
A motive has not yet been determined, but the Associated Press reported that Lam had previously filed a complaint claiming he was working excessive overtime.
Joseph Cilia, with a local Teamsters union that represents UPS workers in San Francisco, told the AP that Lam filed the complaint in March. But Cilia said Lam did not seem angry at the time and Cilia could not understand why Lam appeared to go after three fellow drivers during the shooting rampage.
It was the second shooting to capture national attention Wednesday, coming hours after a gunman opened fire at a park in Alexandria, Va., wounding five people, including House Majority Whip Steve Scalise (R-La.), who is in critical condition at MedStar Washington Hospital Center.
The scene after a deadly shooting at a UPS package center in San Francisco
The San Francisco attack comes nine days after another workplace shooting left five people dead in Orlando, where a former employee armed with a semiautomatic handgun and a hunting knife opened fire at a factory.
UPS, which employs 350 people at the Potrero Hill facility, could not confirm the status of those injured, said Kyle Peterson, a UPS spokesman. All of those killed in the shooting were current UPS employees.
“The company is saddened and deeply concerned about affected employees, family members and the community we share,” UPS said in a statement. “Our thoughts and prayers are with all those touched by this incident.”
After the shootings in Alexandria and San Francisco, social media lit up Wednesday afternoon with reports of another shooting. Reporters in New York City posted messages on social media about gunfire at the Barclays Center in Brooklyn.
A New York City police spokesman said in a statement on Twitter that one person was shot in the leg and was in stable condition. Police were searching for two men after that shooting, he said.
Mark Berman contributed to this report.