Porsche has won the 24 Hours of Le Mans after the leading No.5 Toyota TS050 Hybrid came to a halt on the pit straight with two minutes to go.
It came in one of the most thrilling, race-long battles in recent history, which saw Toyota go head-to-head with Porsche, and lead for most of the race until Kazuki Nakajima lost power on the penultimate lap.
Despite the No. 5 Toyota of Nakajima and co-drivers Anthony Davidson and Sebastien Bueumi not relinquishing the lead for around four hours towards the end, the trio enjoyed a race-long fight with the No. 2 Porsche, as well as the No. 6 Toyota.
More from FoxSports
Jani led the early stages of the race, which started under the safety car due to heavy rain, before Mike Conway put the No. 6 Toyota out front, and held a slight advantage through the night.
However, by sunrise, the No. 5 Toyota was able to take the challenge to the No. 2 Porsche and the sister Toyota in what became an enthralling three-way fight for top honors.
Davidson made the important pass around the No. 2 Porsche of Jani with 4 hours and 4 minutes remaining and held a narrow gap to what appeared to be a clear victory for Toyota Gazoo Racing.
It would have been the first Le Mans wins for 2014 FIA World Endurance Champions Davidson and Buemi, as well as Nakajima, who would have been only the third Japanese driver to claim overall honors.
Jani, Romain Dumas and Marc Lieb had been unable to match Toyota's 14-lap fuel stints over the early stages, which also played into Toyota's hands, and were set for a second-place finish.
However, Nakajima's stopped Toyota opposite the main grandstand handed the win to Jani's Porsche.
The No. 6 Toyota of Conway, Stephane Sarrazin and Kamui Kobayashi finished four laps behind in third, after their bid for victory unraveled in the closing hours.
A spin by Kobayashi, while running third, led to a trip to the garage with less than three hours to go, and put them out of contention, although able to retain its position.
With Toyota and Porsche occupying the top-three overall, it marked the first time that Audi has not scored a podium finish at Le Mans since prior to the program's inception in 1999.
Audi had a miserable outing, with turbo failure for the No. 7 Audi R18 costing the Andre Lotterer, Benoit Treluyer and Marcel Fassler-driven entry six laps early, followed by multiple trips to the garage.
The No. 8 Audi, which also was unable to match the outright pace of the Toyotas and Porsche, finished a distant fourth, after battling brake issues and a lengthy stop to replace its right-hand quarter suspension with four hours to go.
Oliver Jarvis, however, managed to retain fourth place due to further issues for the No. 7 car, which completed the top-five.
Defending World Champions Brendon Hartley, Mark Webber and Timo Bernhard were knocked out of contention in the 9th hour when the No. 1 Porsche replaced its water pump after battling temperature issues.
The car finished 15th overall and sixth in class, benefiting by attrition from all three of the LMP1 privateer entries.
The No. 12 Rebellion Racing Rebellion R-One AER of Nicolas Prost, Nick Heidfeld and Nelson Piquet Jr. claimed privateer honors.
It came after battling an early race misfire, electronics issues, as well as two clutch changes over the course of the race.
Rebellion's No. 13 entry, which claimed overall podium finishes in the opening two WEC races, ran as high as 5th before stopping on track in the 14th hour with issues.
It was classified second, with the No. 4 ByKolles Racing CLM P1/01 AER the only LMP1 retirement after suffering a fire on Sunday morning.
The No. 36 Signatech Alpine A460 Nissan driven by Nicolas Lapierre, Stephane Richelmi and Gustavo Menezes was victorious in the LMP2 class.
It was Lapierre's second LMP2 victory at Le Mans in as many years and came after delivering a faultless run to beat the No. 26 G-Drive Oreca 05 Nissan shared by Rene Rast, Will Stevens and Roman Rusinov by almost a lap.
Rusinov tried gamely to pursue Lapierre in the final stint but, though the car managed to set the fastest lap of the race in the hands of pole-sitter Rast, they had lost too much time with a slow puncture and a drive-through penalty for refuelling while the engine was on to factor in the late reckoning.
Having led sporadically during the early stages as the pitstops cycled through, Signatech hit the front and stayed there in the early hours of the morning.
An impressive quadruple stint from Menezes was enough for Lapierre to emerge ahead of Toyota protégé Ryo Hirakawa in the No. 46 TDS Racing by Thiriet Oreca 05 Nissan.
Thereafter, they managed to consolidate the lead as their rivals fell by the wayside.
Defending winners KCMG would surely have factored when Tsugio Matsuda struck an errant piece of debris during the night, which caused the car to shut down. The Japanese driver made it back to the pits before Richard Bradley suffered a recurrence of the issue and had to retire the car.
Roberto Merhi's well-timed switch to intermediates meant the Spaniard occupied the early lead on his and Manor's first appearance at Le Mans, before Matt Rao dropped back first with a spin, then a slow puncture and rising oil temperatures.
After a lengthy spell in the pits, they would retire for good when Rao crashed at the Porsche Curves.
Further potential winners crashed out within minutes of each other on Sunday morning.
Nelson Panciatici's No. 35 Baxi DC Racing Alpine suffered a suspected brake failure at the first chicane and was shortly joined on the sidelines by Pierre Thiriet after losing control of the No. 46 at Mulsanne Corner.
Amid all the dramas, Signatech were allowed to go take the flag impinged, the team even taking advantage of a Safety Car to complete a routine brake change.
G-Drive Racing's Gibson 015S ran consistently through the night in the hands of Giedo van der Garde Jake Dennis and Simon Dolan, and would likely have finished third at what is likely to be the Gibson's final appearance at Le Mans until Dolan was hit by a GTE Aston Martin in the early hours of the morning.
Instead, it was the No. 37 SMP Racing BR01 Nissan that took third after Vitaly Petrov, Viktor Shaitar and Kiril Ladygin prevailed in battle over the No. 42 Strakka Racing Gibson of Danny Watts, Jonny Kane and Nick Leventis.
Meanwhile, 50 years after its historic victory, Ford has returned to the top step of the podium in the 24 Hours of Le Mans, taking the GTE-Pro win with the No. 68 Ford Chip Ganassi Racing Ford GT.
The team of Joey Hand, Dirk Mueller and Sebastien Bourdais took the Ford to the line after battling with Risi Competizione for most of the race.
Pre-race Balance of Performance controversy aside, the GTE-Pro class battle was just as thrilling and unpredictable as expected, all the way throughout the race.
The race saw countless troubles for the remaining manufacturers: Porsche, Corvette, Ferrari and Aston Martin.
Mueller took the Ford to the finish line a minute clear of Giancarlo Fisichella's Risi Ferrari 488 GTE. The No. 82 Ferrari was shared between Fisichella, Toni Vilander and Matteo Mallucelli.
Fisichella was called in with 15 minutes to go, receiving a black and orange flag for continued issues with the Risi car's leader lights.
The team decided not to bring him in for a stop-go penalty, which could result in a disqualification. As the team usually runs in the IMSA WeatherTech SportsCar Championship, it need not worry about championship points implications.
Scott Dixon secured the final podium position for the No. 69 crew, along with Ryan Briscoe and Richard Westbrook, while Stefan Muecke brought the No. 66 Ford to the line for Olivier Pla and Billy Johnson after losing time in the night to a number panel light issue.
It was a more difficult race for the No. 67 team with missed the start with gearbox issues, and made several other trips to the garage with various problems throughout. Harry Tincknell, Andy Priaulx and Marino Franchitti finished ninth in class.
Perhaps the most unfortunate factory team was Porsche Motorsport, which retired its pair of Porsche 911 RSRs during the night.
The No. 91 car of Patrick Pilet, Kevin Estre and Nick Tandy suffered punctured air cooler caused by a stone, before engine problems took it out of the race. Meanwhile, Frederic Makowiecki, Earl Bamber and Joerg Bergmeister dropped out of contention with their No. 92 car after power steering and front suspension problems.
The two works-entered Porsches had led in the race's early stages, which were held in intermediate conditions, but fell back when the track dried.
Despite a replacement driveshaft, the Dempsey-Proton Porsche managed to finish the race in eighth position with drivers Richard Lietz, Philipp Eng and Michael Christensen.
Corvette Racing was off pace all week, and the defending class champions of Oliver Gavin, Tommy Milner and Jordan Taylor retired after Milner crashed in the early morning at turn 1.
Ricky Taylor took the No. 63 Corvette C7.R to seventh overall alongside Antonio Garcia and Jan Magnussen. That car didn't take to the start of last year's race following a crash during qualifying, but this still wasn't the result they were likely hoping for.
The third manufacturer to struggle was Ferrari, with both of the AF Corse-run 488 GTEs retiring in the night. James Calado damaged the undertray of his No. 51 car early in the race, before an engine issue led to the car of Calado, Alessandro Pier Guidi and Gianmaria Bruni being parked in the garage.
A tire blowout for Davide Rigon signalled the downfall in the No. 71 car's race. After 40 minutes spent limping back to the pits from turn 4, the car he shared with Sam Bird and Andrea Bertolini was retired at dusk.
It was a largely quiet race in GTE-Pro for Aston Martin Racing, save for a puncture picked up by Darren Turner in the No. 95 car while running fourth. The delay dropped him behind the No. 66 Ford to fifth place in the car he shared with Marco Sorensen and Nicki Thiim, while the sister No. 97 Vantage GTE was sixth with Jonny Adam, Richie Stanaway and Fernando Rees.
Jeff Segal held on to secure the GTE-Am victory for Scuderia Corsa, restoring a win for Ferrari after the Risi car missed out.
Segal shared the No. 62 Ferrari F458 Italia with Bill Sweedler and Townsend Bell. This completes the long-time pairing's "triple crown" of wins after victories in the Rolex 24 at Daytona in 2014 and Twelve Hours of Sebring in 2012.
Emmanuel Collard passed David Heinemeier Hansson in the last hour to make it a Ferrari one-two. Collard teamed up with Francois Perrodo and Rui Aguas in the No. 83 AF Corse Ferrari, finishing almost three minutes behind Segal.
Heinemeier Hansson held onto the final podium slot for Abu Dhabi-Proton Racing with Khaled Al Qubaisi and Patrick Long, after being in contention for the win for most of the race in their No. 88 Porsche 911 RSR.
Mok Weng Sun completed the train of GTE-Am cars at the finish, with his Clearwater Racing Ferrari he shared with Keita Sawa and Robert Bell.
The first major retirement of the race was the WeatherTech Racing Porsche, which crashed out at the Dunlop Chicane with Marc Miller at the wheel, in what was a two-driver lineup after Cooper MacNeil was declared unfit to drive.
There were also problems for the No. 98 Aston Martin which had a gearbox failure towards the end of the race, while KCMG lost time after a misfire in its Porsche.