The male suspect also died and several others suffered major injuries in the incident at the public transit maintenance yard in San Jose, just south of San Francisco.
Bomb squads were deployed after reports of explosive devices within the compound, and were trying to “clear out every room and every crevice” of the building, Russell Davis, a Santa Clara County Sheriff’s deputy, told journalists.
“There are eight victims that are pronounced deceased at this point and there is one suspect that’s pronounced deceased,” said Davis, adding those numbers could rise.
“The suspect is a VTA employee,” he added, referring to the local Valley Transportation Authority.
Police had rushed to investigate multiple early morning 911 calls reporting gunshots. No immediate details were provided on whether the shooter was killed by police or took his own life, or about the type of weapon he used.
“Our hearts go out to the victims and their families,” White House deputy press secretary Karine Jean-Pierre told reporters.
“What’s clear, as the president has said, is that we are suffering from an epidemic of gun violence in this country,” she added, renewing calls for Congress to pass long-awaited gun control reforms.
Dozens of patrol cars and fire engines as well as FBI officials lined the streets near the rail yard in San Jose, a Silicon Valley tech hub of almost a million people.
Local officials said the shooting — which was initially reported before 7:00 am local time (1400 GMT) — had taken place at a union meeting, with at least 80 staff on site at the time.
Several people were receiving medical treatment, said San Jose Mayor Sam Liccardo.
“Our hearts are pained for the families of those we have lost in this horrific shooting,” he tweeted.
The incident took place in a VTA yard that is used to store and maintain trains.
“Our thoughts and love go out to the VTA family, the organization and what they have had to go through,” VTA board of directors chairman Glenn Hendricks told reporters.
“I could not be more proud of the VTA organization. This is a horrible tragedy that occurred.”
The VTA tweeted that its employees had been evacuated.
US ‘epidemic’ of gun violence
The United States has a long and painful history of deadly gun violence, in the form of a steady daily toll of shootings as well as high-profile mass killings that have targeted schools, work places and shopping centers.
Homicides, mostly gun-driven, have surged in the US over the past year.
Mass shootings have occurred in recent months at a FedEx facility in Indianapolis, an office building in California, a grocery store in Colorado and at several spas in Atlanta.
In August 2019, another mass shooting in the Bay Area left two children and a 25-year-old man dead at a garlic festival in Gilroy, around 30 miles (almost 50 kilometers) south of San Jose.
President Joe Biden last month branded US gun violence an “epidemic” and an “international embarrassment.”
There were more than 43,000 gun-related deaths in the United States last year, including suicides, according to the Gun Violence Archive.