Harrowing footage of a young schoolboy narrowly avoiding being hit by a train has stunned viewers around the world.

The unbelievable CCTV footage, captured in Riga, Latvia, shows the unidentified child suddenly jumping out of the way of a train coming at full speed.

Be the first to know when news breaks. Download our new app

The clip sent shockwaves across the internet, with many pointing out that if he had jumped just one second later, he likely would have been killed.

In the heart-stopping clip, the boy can be seen approaching the tracks without looking left and right, and quickly realises that a train is coming.

He frantically leaps out of the way as he notices the train speeding towards him, missing him only by what looks like mere millimetres.

After the train thunders past, he appears dazed, but quickly gathers his things and goes on his way unharmed.

The train involved in the shocking near-miss was heading to the western town of Tukums.

Transport authorities in Latvia made the decision to release the video as part of a wider campaign about rail safety.

“About to miss your train? No matter how important it seems to make it in time, nothing is worth your life,” the campaign states.

“Remember – a train cannot stop immediately.

“We encourage parents to discuss the rules of safe behaviour near railway tracks with their children, stressing that their safety is far more important than catching a train.”

Protesters came together to demand safer crossings in the capital Riga earlier this year.

The demonstrators claimed that the council had failed to improve railway traffic safety at the station and demanded that more effective barriers be built for pedestrians.

In the last eight months, there has been two incidents of three people being killed at the same crossing, while in October last year, two schoolgirls were hit by a train while crossing on an electric scooter.

Closer to home, around 21 people are killed each year on train tracks in Australia in non-intentional fatalities, according to the TrackSAFE Foundation

There are a further 1000 near misses.

In response to the question of why trains cannot simply just stop, an article by the Australian Government’s Regional Rail Safety highlighted the reasons.

“Trains are fast and take up to two kilometres to stop once the train driver has applied the emergency brakes,” the article explained.

“Freight trains travel between 80 and 160 kilometres per hour, while passenger trains can travel up to 200 kilometres per hour.

“A train driver may not be able to stop in time if you cross the railway crossing when they are approaching.”

They also provided tips on how to stay safe around trains.

“Be aware of ‘passive’ railway crossings that don’t have boom gates, lights or bells,” they stated.

“As you drive into regional and rural areas, you will encounter more passive railway crossings.

“To cross safely, you need to do three things. Slow down because trains go fast and can appear suddenly.

“Look both ways as far as you can, because trains are hard to see. Trees and sun glare can make it even trickier to see sometimes.

“Listen because train drivers are instructed to use their horn when approaching passive railway crossings.

“Often, you’ll hear a train before you see it.”