San Mateo County Board of Supervisors President Dave Pine says four people were killed at the farm and three at the trucking business on the outskirts of Half Moon Bay, a city about 48 kilometres south of San Francisco.
It wasn’t immediately clear how the locations were connected.
California state Senator Josh Becker, who represents the area, said people were killed in separate shootings. San Mateo County Supervisor David Canepa tweeted that one shooting happened at a mushroom farm.
The San Mateo County Sheriff's Office tweeted just before 5pm (12pm AEDT) that a suspect was in custody.
“There is no ongoing threat to the community at this time," the sheriff's office said.
Television footage from the area showed officers taking a man into custody without incident.
Sign up here to receive our daily newsletters and breaking news alerts, sent straight to your inbox.
Aerial television images also showed police officers collecting evidence from a farm with dozens of greenhouses.
The shooting followed the killing of 11 people late Saturday at a ballroom dance hall in Southern California.
“We are sickened by today’s tragedy in Half Moon Bay," Dave Pine, president of the San Mateo County Board of Supervisors, said in a statement.
“We have not even had time to grieve for those lost in the terrible shooting in Monterey Park. Gun violence must stop.”