A commuter train struck a tree and derailed in storm-soaked Northern California, plunging its lead car into a rain-swollen creek and sending passengers scrambling in the dark to get out of the partially submerged car.

Nine people were injured, four seriously, the Alameda County Fire Department said.

Rescuers battled the creek's fast-moving currents Monday night to pull riders to safety, Alameda County Sheriff's Sgt. Ray Kelly said.

"It was dark, wet, it was raining. It was very chaotic," Kelly said. "This is an absolute miracle that no one was killed, no passengers or first responders."

The San Francisco Bay Area has been inundated with thunderstorms in recent days that have swamped roadways and creeks. On Monday, some San Francisco Bay Area roads were under more than 300 mm of water. Santa Cruz and Santa Clara counties saw about 279 mm of rain over the weekend.

Union Pacific spokesman Francisco J. Castillo says a mudslide most likely swept the tree onto the Altamont Corridor Express train tracks Monday evening.

The Altamont Corridor Express (ACE) No. 10 commuter train was traveling from San Jose to Stockton when the first two cars went off the tracks in Sunol, a rural area of Alameda County about 72 kilometres east of San Francisco. One toppled over, while the other remained upright.

Altamont Corridor Express train official Steve Walker said the first car was carrying six passengers and one crew member when it fell into Alameda Creek.

Passengers described a harrowing scene.

Rad Akhter said he was in the front car that fell into Alameda Creek and saw a woman lying in mud just under a train car hanging off the tracks.

"We were all just panicking," Akhter, who waited wrapped in a blanket for a ride home, told San Jose television station KNTV.

Passenger Russell Blackman told KGO-TV he was in the second car, which stopped near the creek.

"Our car went off the track and stopped right at the edge, which was a blessing," Blackman said. "I was thrown out of my seat. I hurt my shoulder, but I'm not going to complain."

The ACE No. 10 train, which travels from Silicon Valley to Central California, stopping in eight cities along the way, was carrying 214 passengers, officials said. ACE has had only one other derailment in the past decade.

All Altamont Corridor Express trains travelling from Silicon Valley to the Central Valley were cancelled on Tuesday.