SUNNYVALE — A San Mateo County Sheriff’s deputy saved a driver’s life Monday night after he pulled the man out of a car just before an oncoming Caltrain hit it, authorities said.

Around 6:35 p.m., a man’s black sedan was seen stopped on the train tracks at Mary Avenue in Sunnyvale, according to Caltrain spokeswoman Jayme Ackemann. San Mateo County Sheriff’s deputies responding to a call nearby saw the car, and one of the deputies yanked the man out of his car.

In a harrowing video capturing the incident, passers-by can see the sheriff’s deputy pull the man out of the car and next to the tracks. But within seconds, a northbound Caltrain’s horn can be heard as it barreled down the track, heading straight for the car. The sheriff’s deputy can be seen grabbing the driver, who has not been identified, by the wrist and quickly dragging him away from the car.

Then, the train smashes into the car, sending it spinning on the tracks.

No one was hurt, according to Caltrain officials.

“That action may have saved the vehicle operator’s life and certainly helped to prevent significant injury or additional delays for the customers using the system this evening,” Ackemann said in a news release.

The identity of the sheriff’s deputy who saved the driver has also not been released.

It was unclear why the man was on the tracks.

Commuters heading home Monday night can expect residual delays from the incident.

Check back for updates.

Contact Katie Nelson at 408-920-5006 and follow her at Twitter.com/katienelson210.