The boy was in a small black Fiat driven by his mother when the vehicle collided with a 65-kilo deer on a road between the communities of La Punt and Bever (near St. Moritz), cantonal police said.
The vehicle turned upside down and landed on the tracks just as a train from the narrow-gauge Rhaetian Railway (RhB) approached, shortly after 8am.
The 42-year-old woman, a resident of St. Moritz, was able to exit the vehicle but was unable to get her son out, police said.
She tried to get the attention of the train driver, who braked but was unable to prevent a collision.
The car was tossed off the tracks and landed on its wheels but the boy survived with just minor bruises, cantonal police said.
The woman and the train driver were treated for shock while the eight passengers on the train were uninjured, according to a police report.
The deer was killed on impact.
The train locomotive derailed, while the car was a write-off.
The accident disrupted traffic on the RhB rail line for several hours during which replacement buses were put in service between Zuoz and Samedan.
“It was only by a miracle that nothing happened to my grandson,” the grandmother of the four-year-old told the 20 Minuten newspaper.
The newspaper quoted a witness describing how the mother had tried to stop the train.
“You could only watch as the train crushed the car with her son in it.”
The child apparently survived solely because he was sitting in the back seat of the car — the only part of the vehicle that remained intact after the crash.