The man first crashed a Volkswagen Jetta into a signpost on the Central Expressway off-ramp at Mary Avenue shortly after 7 a.m. before crashing into the north side of the tracks, according to Sunnyvale police Officer Casey O'Hara.
The car became stuck on the tracks and the driver moved out of the way just as a train smashed into the car, O'Hara said.
The driver was not injured but was arrested on suspicion of driving under the influence and hit and run, for leaving the scene of the signpost accident, according to O'Hara.
Trains were initially stopped in both directions, but both tracks reopened by 9 a.m. and trains were traveling slowly through the area, Caltrain spokeswoman Christine Dunn said.
Trains were delayed by up to an hour and a half but were back on time by 11 a.m., Dunn said. A tow truck removed the car from the tracks.