A frightened eight-year-old boy covered his face with his hands after he had been pushed onto railway lines as a train approached, Birmingham Crown Court was told.
It is alleged a 14-year-old, from Small Heath, shoved the boy onto the tracks in Bordesley in April last year.
The teenager has denied two charges of doing an unlawful act with intent to endanger a person on the railway.
Neil Williams, prosecuting, said, at the time the defendant was in charge of both the eight-year-old and his nine-year-old sister. He said that on April 9 the 14-year-old had shoved the boy into a busy road at a roundabout and had also pushed him towards a canal.
It is alleged they had then gone up a railway embankment, where the victim was left standing between the tracks as trains passed in each direction.
In a video interview with a police officer shown to the jury, the boy said that earlier in the day he had gone to a nature centre and McDonald's before the incidents on the road and at the canal, where he clung onto a ladder to stop himself falling in.
He said that, when he was on the railway, he had felt "really scared'' and demonstrated putting his hands over his face.
The boy said the incident lasted about 20 seconds and he had heard the 14-year-old laughing. He said as the trains passed, he had stood tall and straight and had heard a train driver telling him to move out of the way.
He said the defendant had thrown stones at the train.
The alleged victim said he had then run down the bank and the defendant had told him not to say anything about what had happened, or he would "batter'' him.
The jury was also shown a video of the boy indicating to a police officer where the alleged incidents took place.
The trial continues.