LE MANS, France -- Veteran German driver Timo Bernhard led Porsche to a dramatic third straight win at the 24 Hours of Le Mans, preventing a huge upset victory for the lesser-category Oreca team Sunday.
After a series of mishaps to prerace favorites Porsche and Toyota, the LMP2 category Oreca suddenly found itself in the lead with 19-year-old Frenchman Thomas Laurent behind the wheel three hours from the end of the grueling endurance race.
But the 36-year-old Bernhard, racing in the faster and more powerful LMP1 category Porsche 919 Hybrid, overtook the Oreca with about one hour remaining.
As the Porsche No. 2 crossed the finish line, there were scenes of relief in the Porsche garage as team members danced around holding up T-shirts with "Hat trick 2015, 2016, 2017" written on them.
"Well done, everybody," an exhausted Bernhard said over the team radio. "You're the best."
Teammate Brendon Hartley, who had done much of the hard work to drag Porsche back into the race, was in tears.
"It was unreal. This race is always a roller coaster," said Hartley, who won it for the first time. "It was an incredible team effort. I'm going to remember this forever."
Hartley and fellow New Zealander Earl Bamber rushed over to jump on the No. 2 car as the co-drivers celebrated wildly. Bamber also won in 2015 alongside F1 driver Nico Hulkenberg.
Bernhard finished about one minute ahead of the Jackie Chan DC Racing car, owned by the famed action movie star.
Another Oreca LMP2 car -- driven by Nelson Piquet Jr., the son of the famed Brazilian F1 driver, finished in third place for the Vaillante Rebellion team.
Bernhard also won the race in 2010 when driving for the dominant Audi team.
It was a fantastic comeback win considering that the Porsche No. 2 was held up for more than an hour because of technical problems earlier in the race and at one point was in 56th place.
"It was absolutely crazy. When I heard it [the engine] go 'bang,' I thought 100 percent our race was over," Bamber said. "The guys turned it around. We thought we would finish in the top five. But this race really chooses you when it wants you to win."
A year after American actor Brad Pitt got the race underway, Formula One chairman Chase Carey was the official starter for the 85th edition. While last year's race provided a Hollywood finish, Carey enjoyed another intense race.
After losing to Porsche on the final lap last year, Toyota encountered further mishap at the Circuit de la Sarthe.
Chasing a first victory, Toyota had high hopes after former F1 driver Kamui Kobayashi broke the lap record in qualifying.
But deep into the night, Toyota's woes began with Kobayashi cruising in the lead.
At around 1 a.m., Kobayashi seemed to have a gear box failure and was reduced to crawling around the track at around 35 mph. A short time later, he was forced to abandon the race, climbed out of the car and waved goodbye to the fans.
Just minutes later, Toyota could not believe its bad luck when car No. 9, driven by Nicolas Lapierre, sustained a rear tire puncture. Then his car stopped with flames shooting out of it.
That left just one Toyota -- the No. 8 driven by former F1 driver Sebastien Buemi of Switzerland -- which was way behind.
By 9 a.m., the Porsche No. 1 car was comfortably in the lead.
But then it was Porsche's turn for a setback.
With about four hours to go, the Porsche No. 1 driven by German Andre Lotterer started losing oil pressure and limped back to the garage. Despite a complete electronic reset, No. 1 Porsche abandoned.
With three hours left, the LMP2 car Oreca driven by Laurent suddenly found itself two laps ahead of Hartley's Porsche -- which was chasing at nearly 10 seconds per lap faster.
Bernhard replaced Hartley to set up a thrilling finish around the 8.45-mile track.
Laurent's lead was less than two minutes with about an hour to go, at which point he handed over to Chinese driver Tung Ho-Pin.
There was little chance Tung could hold off Bernhard, but it was still a close call for Porsche to secure its 19th Le Mans trophy.