A San Francisco Bay Area commuter train derailed after it reportedly crashed into a tree on the tracks , sending one car tumbling into a creek and injuring 14 passengers, four of them seriously.

Some 214 commuters were on the Altamont Corridor Express train travelling from Silicon Valley to Stockton when the crash occurred in a largely rural area just east of San Francisco.

Several trees have been knocked over by heavy winds and driving rain over the past few days.

The front car of the ACE commuter train was half submerged in the fast-running Alameda Creek, its lights still on, as passengers were evacuated. The second car also derailed, but remained upright, the SF Gate reported.

Emergency crews broke windows to release some of the passengers from the first car as others scrambled up the bank to escape the water.

"We're very lucky," said Alameda County Sheriff Sergeant Ray Kelly. "It's absolutely a miracle that nobody was killed."

John Wong, 49, was in the last car of the train, travelling home from his work as an engineer at a semiconductor company in Sunnyvale, when the train derailed.

"There were a couple of huge jerks and then the train stopped," he said. He and the other passengers, stunned by the crash, waited until police told them to exit.

None of the injuries was life threatening. Twelve of the 14 commuters taken to local hospitals were in the front car.

Other passengers were removed to a nearby fairgrounds for further assessment and transportation.

Investigators from the National Transportation Safety Board were notified of the accident.