(CNN)Lucas di Grassi won a thrilling Mexico E Prix, pipping race leader Pascal Wehrlein as his battery died on the line.
Lucas di Grassi wins Mexico E Prix as race leader's battery dies on the line
Mahindra's Wehrlein led for large parts of the race but his battery's charge hit 0% just meters from the end, allowing Di Grassi to pass him on the inside.
The German driver was eventually demoted to sixth place after a five-second penalty for cutting off a chicane, as Antonio Felix da Costa and Edoardo Mortara came second and third respectively.
"I pretended to go to the outside and he opened a small door, just enough for the car to fit between the wall and the car and I went there," a shirtless and champagne-soaked Di Grassi told reporters of his last-gasp overtake.
"I couldn't believe it. My adrenaline is still super high. It was amazing. I knew he was running out of energy so I was putting pressure to overtake in the last five lap.
"This was probably the best Formula E race of my career because it was a mixture of having the patience to save energy in the beginning and then making the moves in the correct moment."
Jerome D'Ambrosio, Wehrlein's Mahindra teammate, retained his overall championship lead thanks to his fourth place finish in Mexico.
Officials were forced to red flag t