The equine broke out of its paddock near Schwanheide station, three quarters of an hour to the east of Hamburg. But the horse got its hoof stuck in a switch on the line and was unable to free itself, Stern magazine reports.
A high-speed train travelling between Berlin and Hamburg was able to come to a halt before colliding with the animal.
But the busy line nonetheless had to be closed down for an hour on Thursday afternoon, leading to delays on seven services.
After emergency service crews freed the horse, a vet was able to confirm that he had remained uninjured by the incident.