A Utah state trooper risked his life to rescue an unconscious man from a car while a train came roaring toward them — and the whole scene was caught on camera.

Patrolman Ruben Correa spotted the car on the tracks in the town of Centerville, north of Salt Lake City, and noticed the driver inside the SUV as the train sped their way.

“Let's go, get outta here,” Correa shouted. “We got a train coming! We got a train coming! We got a train coming! We got a train coming!”

Correa managed to get the driver out of the car in the nick of time, right before the train plowed into the vehicle.

The man, who police say experienced a medical emergency that resulted in him losing control of the car as well as consciousness, turned down interview requests, but did say he is grateful to be alive. He is not expected to be charged with any crime.

Meanwhile, Correa is just happy the story had a happy ending.

“I’m still trying to process everything that happened,” Correa said. “I'm just very grateful that I was able to get him out and he's alive and he's back with his family now.”