The book had a scene where a girl and her friend are riding on horseback through the woods when they come across a train bridge. They decide to ride on it despite one of them not wanting to. The bridge leads into a tunnel. They are halfway through when a train is coming behind them and they are trying to race their horses out before they get hit. The girl makes it out just in time. I think she may have jumped the horse off the bridge and got lost from her friend (can't remember much after the tunnel).
You are describing a scene from Point Blanc, the second novel of the Alex Rider series by Anthony Horowitz.
The protagonist of this book is Alex Rider, a teenage James Bond style secret agent. In this book, he has to infiltrate Point Blanc, a special school for selected teenage kids of millionaire parents. Alex has to infiltrate the school by adopting the cover identity of Alex Friend, son of a rich businessman Sir David Friend. To prepare for the role, Alex spends a few weeks on the estate of David Friend with his family, who are in to the deception. Alex rides a horse with David's daughter Fiona, and saves her in a railway tunnel in the way you describe.
You might also recall the event described in the first chapter of the book. In this, the millionaire Michael J. Roscoe falls to their death in an elevator shaft. An assassin has reprogrammed the elevator so the door opened when the elevator wasn't on the right storey, but also installed a holographic projector that projected a realistic image of the elevator car so that the businessman doesn't notice this. The chapter seems unconnected to the rest of the book at first, though importance in the story is revealed later. If you have read this in English original, you can find the text of this first chapter as a free sample on the publisher's website to see if it rings the bell.
(Cover image of Point Blanc taken from publisher's website. Note that the book has been republished under different covers.)