Crews had to fight the creek's fast-moving currents to pull riders from the partially submerged rail car, 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."
Four people were seriously hurt, while 10 others had minor injuries, Kelly said.
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 near Niles Canyon Road in Sunol, a rural area of Alameda County about 45 miles east of San Francisco.
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.
Walker told San Jose television station KNTV the second car behind it also derailed but remained upright.
He said three more cars behind, including the locomotive, stayed on the tracks.
Images posted on Twitter by Alameda County Fire Department showed that car on its side about half-submerged in the creek water.
Passengers were evacuated and checked by paramedics. The uninjured riders were transported to the Alameda County Fair in Pleasanton, the department said.
Altamont Corridor Express said it sent buses to take passengers to their destinations. The company also said it was cancelling all train service on the line Tuesday.
The ACE No. 10 train travels from San Jose to Stockton, stopping in eight cities along the way.
Train officials said the train was carrying 214 passengers from Silicon Valley to Stockton.