An employee fatally shot eight people at a California train yard before turning the gun on himself as police closed in.
The shooting took place at the Santa Clara Valley Transportation Authority (VTA) site in San Jose.
“When our deputies went through the door, initially he was still firing rounds,” Santa Clara County Sheriff Laurie Smith told journalists.
Officials say the victims include transit employees.
The gunman opened fire early at around 06:45 local time (14:45 GMT) on Wednesday in the VTA light rail yard. According to a local CBS station, the attack unfolded during an employee meeting.
Law enforcement officials told CBS News, the BBC’s partner in the US, that the gunman was 57-year-old Samuel Cassidy.
His ex-wife, Cecilia Nelms, told the Associated Press news agency that Cassidy would tell her that he wanted to kill his colleagues, but she had never believed he would do it.
Doug Suh, a neighbour of Cassidy, told the Mercury News the gunman was “lonely” and “strange”.
Deputy Russell Davis, a spokesman for the Santa Clara County Sheriff’s Department, said “deputies did not exchange gunfire” with the suspect.
“Preliminarily, we’re going to go with the assumption it was a self inflicted gunshot.”
Just before the shooting, a fire broke out at a home belonging to Cassidy, according to local media.
Authorities say they are looking into whether the suspect may have set his home on fire before embarking on the rampage.
The Santa Clara VTA – Valley Transport Authority – operates three train lines, making up over 40 miles (65km) of rail. It also operates about 70 bus lines in the city.
Santa Clara is the largest county in California’s Bay Area and is home to Silicon Valley. It encompasses several cities in Northern California including Cupertino, San Jose and Mountain View.
Speaking from near the crime scene, Governor Gavin Newsom condemned the “rinse and repeat” cycle of US mass shootings.
“What the hell is wrong with the United States of America?” said the Democrat. “When will we put down our arms?”
US President Joe Biden called the attack a “horrific tragedy” and ordered flags to be flown at half mast as he again urged Congress to take action on gun control.
“Every life that is taken by a bullet pierces the soul of our nation,” he said. “We can and we must do more.”