LE MANS, France (Reuters) - Porsche won the 24 Hours of Le Mans for the third year in a row on Sunday with a stunning last-to-first victory in a race of retirements that left early favorites Toyota nursing more heartache.

The German manufacturer’s 19th outright win at the Circuit de la Sarthe followed a night of drama with Toyota’s top two cars retiring and the number one Porsche also suffering a terminal problem while leading with four hours to go.

That left the number two Porsche, shared by German Timo Bernhard and New Zealanders Brendon Hartley and Earl Bamber, to move surprisingly back into contention after being at the back of the field on Saturday.

The trio’s chances had been written off by team bosses when the car suffered front axle problems and spent 90 minutes in the garage before rejoining some 22 laps adrift of the leading Toyota.

“It can be the cruelest race or it can be the best race ever. You never know,” said Bernhard, a winner with Audi in 2010, who did the final stint to take the chequered flag.

“Every lap counted, every second, to get back to P1.

“The goal was to get maximum manufacturers’ and drivers’ points,” he said of the feeling on Saturday. “Then this morning we saw that actually we can do a little bit more, maybe the podium.”

Bamber had won with Porsche in 2015 but Sunday was a first for Hartley, the only driver in the two crews yet to taste overall victory at Le Mans.

It was the first time since 1966, when Bruce McLaren and Chris Amon won for Ford, that two New Zealanders had shared the winning car.

The trio hugged and embraced before the podium celebrations in front of a crowd of 260,000.

‘CRAZY RACE’

Their joy could have been that of the number one Porsche drivers -- Neel Jani of Switzerland, Britain’s Nick Tandy and Germany’s Andre Lotterer -- who were 13 laps clear when the car halted with four hours to go.

“I’m speechless. It’s a crazy race,” said Lotterer after being sidelined by an oil pressure issue.

The podium was completed by two second tier LMP2 entries, with the number 38 Jackie Chan DC Racing Oreca -- the team backed by the Hong Kong action movie star -- finishing as runner-up.

Dutch-born Hong Kong racer Ho-Pin Tung shared that car with Britain’s Oliver Jarvis and Frenchman Thomas Laurent.

Vaillante Rebellion’s number 13 Oreca driven by Brazilian Nelson Piquet Junior, Denmark’s David Heinemeier Hansson and Switzerland’s Mathias Beche took third place.

Early pace-setters and favourites Toyota saw their hopes of becoming only the second Japanese manufacturer to win, after Mazda in 1991, disappear in an agonizing half hour after midnight.

After securing pole position with a record fastest lap on Thursday, their number seven and nine cars retired in quick succession.

“It is so disappointing. The car was running very well and we were just taking things steady, building a gap at the front. Then after the safety car, I just had no power,” said pole-sitter Kamui Kobayashi.

The former Formula One driver was halted by a clutch problem in the leading number seven car around the 10 hours mark.

The team, five times runners-up, missed out last year when their leading car broke down on the final lap only minutes from the chequered flag.

“I tried to come back to the pits but it wasn’t possible. I feel so sad for everyone in the team who has worked so hard for this race and produced such a quick car,” said Kobayashi.