The shootings occurred on the outskirts of Half Moon Bay, a city about 30 miles (48km) south of San Francisco
The incident marked the state’s third mass killing in eight days, including an attack at a dance hall on Saturday in which 11 people died during Lunar New Year celebrations.
Officers arrested a suspect in Monday’s shootings, 67-year-old Chunli Zhao, after they found him in his vehicle in the car park of a sheriff’s substation, San Mateo County Sheriff Christina Corpus said.
Four people were found dead and a fifth injured with gunshot wounds at a farm, and officers found three other people killed at another location several miles away, the Sheriff’s Office said.
The killings occurred on the outskirts of Half Moon Bay, a city about 30 miles (48km) south of San Francisco. Ms Corpus said the two locations were nurseries, but it was not immediately clear how they were connected.
The new year has brought a shocking string of mass killings in the US – six in less than three weeks, accounting for 39 deaths.
Three have occurred in California since January 16, according to a database compiled by The Associated Press, USA Today and Northeastern University. The database tracks every mass killing – defined as four dead not including the offender – committed in the US since 2006.
Officials believe Zhao was a worker at one of the facilities and that the victims were also employees, Ms Corpus said.
Some workers at one facility lived on the premises and children may have witnessed the shooting, she added.
She said officials have not yet determined a motive for the shooting.
Half Moon Bay Vice Mayor Joaquin Jimenez said the victims included Chinese and Latino farm workers.
The Sheriff’s Office first received reports of a shooting just before 2.30pm local time and found four people dead from gunshot wounds and a fifth person injured at the first scene.
Shortly afterwards, officers found three more people dead from gunshot wounds at a second location nearby, Captain Eamonn Allen said in a news release.
About two hours after first responding, a sheriff’s deputy noticed the suspect, Zhao, in his car parked outside a sheriff’s substation in a row of shops and arrested him, recognising the vehicle by its licence plate.
A video captured by Kati McHugh, a Half Moon Bay resident who witnessed the arrest, showed three officers approaching a parked car with drawn weapons.
Zhao got out of the car, and the officers pulled him to the ground, put him in handcuffs, and led him away. A weapon was found in his vehicle, officials said.
The sheriff’s department believes Zhao acted alone.
“We’re still trying to understand exactly what happened and why, but it’s just incredibly, incredibly tragic,” said state Senator Josh Becker, who represents the area and called it “a very close-knit” agricultural community.
Aerial television images showed police officers collecting evidence from a farm with dozens of greenhouses.
Half Moon Bay is a small coastal city with agricultural roots, home to about 12,000 people. The city and surrounding San Mateo County area is known for producing flowers as well as vegetables like Brussels sprouts. The county allows cannabis farming in certain areas.
It is a majority white community and about 5% of the population is Asian, according to census data.
“We are sickened by today’s tragedy in Half Moon Bay,” said San Mateo County Board of Supervisors president Dave Pine.
“We have not even had time to grieve for those lost in the terrible shooting in Monterey Park. Gun violence must stop.”
California Governor Gavin Newsom tweeted that he was “at the hospital meeting with victims of a mass shooting when I get pulled away to be briefed about another shooting. This time in Half Moon Bay. Tragedy upon tragedy.”
On January 16, a teenage mother and her baby were among six people killed in a shooting at a home in California’s Central Valley.