IMOLA, Italy — Facing the barriers of the Imola track, Lewis Hamilton could feel the race and potentially the title slipping away from him.

The world champion had run wide through the gravel trap and nudged into the barriers on lap 31 of the Emilia-Romagna Grand Prix on Sunday.

It appeared as if his race was over but, after a lengthy delay, Hamilton managed to reverse back onto the track and re-join the race. He was in ninth place but a stunning drive saw him sweep through the field to finish second.

“I definitely didn’t know I would be here when I was facing that barrier,” Hamilton said at a post-race news conference for the top three finishers.

“We’re only human, so just that bit of a mistake was one to learn from. I’m just grateful I could get going again and get back into the race. It’s not how you fall; it’s how you get up. Really awesome to get back to second.”

Hamilton said he relished the fight back and that it took him back to his roots, to his early racing days in karting.

And it is the British driver’s ability to cope with adversity that could be an important weapon in his bid for a record eighth world championship title — where he could be pushed closer than ever this season.

“I think, in life, when you experience whatever form of adversity in terms of challenges or mistakes and mishaps or whatever barriers you find that you have to get over or hurdles, it’s always more satisfying when you overcome them,” Hamilton said.

“It’s not the mistakes that define you, it’s not how you fall, it’s how you get back up. I honestly feel like these things happen for a reason . . . I remember just sitting there, looking at the barrier and I refused to think that the race was over. I refused to believe that the race was done. I could have obviously just turned the car off and got out but I’m grateful that I didn’t.”

If Hamilton had turned his car off he would have found himself at least 18 points behind Max Verstappen after the Red Bull driver eased to victory in the second race of the season.

With Red Bull seemingly having the faster car, Hamilton admitted that would have dealt a significant blow to his title chances — even at this early stage of the season.

But Hamilton’s perseverance saw him even maintain his lead at the top of the standings after earning a bonus point for the fastest lap. The Mercedes driver, who won the season-opener in Bahrain last month, is one point ahead of Verstappen.

“Without doubt, getting back to second and getting these points today will be very valuable through the season,” Hamilton said. “If I’d lost 25 points today, that would have been hard to recover with the fact that Red Bull, it’s the first time that they’ve had a championship-winning car, their car is incredible fast.

“But we’ve got a real close battle which we love the fact that it’s a close battle . . . so there’s going to be a lot of exciting races up ahead and challenging for all of us in so many different ways.”

Next up in the 23-race calendar is the Portuguese GP on May 2.

___

More AP auto racing: https://apnews.com/hub/auto-racing and https://twitter.com/AP_Sports