The two TS050 Hybrids were a class apart from their LMP1 rivals, with the battle for the win quickly boiling down to a two-way battle between the Toyotas.

It was nip and tuck between the #8 machine and the #7 of Mike Conway, Kamui Kobayashi and Jose Maria Lopez for the majority of the distance, with a rapid night stint by Alonso helping to mitigate the effects of a 60s stop-and-go penalty earned by Buemi for speeding in a slow zone.

Nakajima moved the #8 car back ahead at Arnage in the 16th hour, and from thereon it held the advantage, helped by a spin for Lopez at the Dunlop chicane with a little over three hours to go.

Kobayashi then dropped a lap behind the sister car when he missed his lap to pit for fuel, obliging him to cruise round for half a lap or so and earning the #7 car a pair of late penalties for exceeding the mandated 11-lap stint.

That meant that Nakajima crossed the finish line with two laps in hand over Kobayashi, earning Toyota its first-ever outright Le Mans victory after a host of recent near-misses, most famously in 2016.

Buemi said: “I can’t really describe it because when you look at the past, 2016, in the last lap. Kazuki was going to be in the car for the last few laps [again], so lots of emotions really. When I saw the car crossing the line I could not believe it really.”

Rebellion's pair of R-13 Gibsons emerged as the strongest privateer LMP1s, but both encountered a host of technical issues and finished 12 and 13 laps down respectively.

The #3 car shared by Gustavo Menezes, Thomas Laurent and Mathias Beche gained the upper hand over the sister car of the #1 machine of Neel Jani, Andre Lotterer and Bruno Senna, who lost ground in the closing hours with a door coming loose and penalties for exceeding stint length.

Manor's #5 Ginetta G60-LT-P1 was the only other LMP1 finisher, as both SMP Racing BR1s, the #10 DragonSpeed BR1, the #6 Ginetta and the #4 ByKolles ENSO CLM P1/01 all fell by the wayside.

Dominik Kraihamer ensured the ByKolles squad was the first official retirement of the race when he crashed lapping GTE Am traffic at the Porsche Curves, while Matevos Isaakyan in the #17 SMP BR1 spun into the barriers at the same part of the track some hours later.

The second BR1, which lost almost 50 laps early on with an electronics gremlin, stopped at the start of the final hour while Jenson Button was driving with engine trouble.

DragonSpeed's Gibson-powered customer BR1 suffered floor and alternator issues in the evening before an off for Ben Hanley at the Porsche Curves in Hour 20 ended the team's race.

LMP2: G-Drive cruises to victory

The #26 G-Drive Racing Oreca of Jean-Eric Vergne, Andrea Pizzitola and Romain Rusinov led virtually the whole race in the LMP2 category to give the TDS-run squad its first Le Mans victory.

After lining up third, Vergne lost places at the start and ran sixth prior to the first round of pitstops in the opening hour, but emerged in a lead that it kept for the rest of the race, marrying strong pace with no unscheduled pitstops or on-track incidents to take a two-lap lead over the chasing #36 Signatech-Alpine of Nicolas Lapierre, Andre Negrao and Pierre Thiriet.

The #36 crew was unable to match the #26 car when two-time event winner Lapierre was not at the wheel and was never in the victory fight after it fell off the lead lap in the 11th hour, but enjoyed a largely clean run with the exception of a spin for Thiriet.

Any number of cars could have finished third, but it was the unheralded #39 Graff-SO24 Racing Oreca of Tristan Gommendy, Jonathan Hirschi and Vincent Capillaire that edged out the #28 TDS Racing Oreca of Loic Duval, Matthieu Vaxiviere and Francois Perrodo by 2.5 seconds in the final reckoning.

Duval was 34 seconds ahead when he made his final pitstop, but emerged 25s behind his compatriot and was unable to make up the deficit. That allowed Graff-SO24 to take a surprise podium, despite serving a one minute stop-and-go penalty in the 14th hour for speeding in a slow zone.

Behind the #28 TDS car, the #32 United Autosports entry featuring Juan Pablo Montoya finished best of the Ligiers in fifth after a series of late dramas befell the marque.

Montoya outbraked himself and nosed into the tyres at Indianapolis in the sixth hour, but was still on course for fourth place with Hugo de Sadeleer and Will Owen before a puncture in the penultimate hour dropped it a lap behind the cars ahead.

Paul di Resta had been running fourth in the sister #22 United Autosports Ligier with four hours to go when he crashed heavily at the Porsche Curves and retired.

Another Ligier in podium contention, the Panis-Barthez Competition #23 of Will Stevens, Julien Canal and Timothe Buret, lost an hour in the pits shortly after di Resta's crash and eventually finished 11th.

GTE Pro: Porsche claims 1-2

Porsche claimed GTE Pro class victory, with its pair of retro-themed, Manthey-run 911 RSRs claiming a 1-2 finish for the Weissach brand.

The early safety car broke up what had been an early three-way scrap for the lead, giving the 'Pink Pig'-themed #92 entry driven by Kevin Estre, Michael Christensen and Laurens Vanthoor an advantage of more than a minute over the #91 Rothmans-coloured Porsche and the best of the Fords, the #68 car.

From there, the #92 crew were never seriously threatened, and by the eight-hour mark enjoyed a lead of more than two minutes which they were able to maintain over the remaining distance until a final hour splash-and-dash for Christensen.

The battle for second between the #91 Porsche and the #68 Ford heated up in the morning hours, as Sebastien Bourdais hit out at Frederic Makowiecki for what he felt was unacceptable driving during a thrilling scrap in the 21st hour.

But their battle was not to last as Makowiecki got away after the next round of stops, helping to secure second for himself, Gianmaria Bruni and Richard Lietz by a margin of 26 seconds ahead of the Ford shared by Bourdais, Dirk Muller and Joey Hand.

Ford's leading WEC-entered car, the #67 of Harry Tincknell, Andy Priaulx and Tony Kanaan, was a further minute behind in fourth, while Corvette got its leading entry home, the #63 of Jan Magnussen, Antonio Garcia and Mike Rockenfeller, a lapped fifth.

Ferrari's top finisher was the sixth-placed #52 car shared by Pipo Derani, Antonio Giovinazzi and Toni Vilander, two laps down, while Aston Martin's leading Vantage GTE finished ninth, five laps down.

BMW's pair of M8 GTEs both hit suspension troubles, with the #81 car finishing 11th after losing further time having to have its radiator changed. The sister #82 car retired when Alexander Sims crashed at the Porsche Curves in the early hours of the morning.

Also failing to finish were the #64 Corvette, which suffered engine trouble, and the #94 CORE autosport-run Porsche due to a terminal suspension problem. The #69 Ford also spent the final two hours of the race in the garage with an electrical issue.

GTE Am: Dempsey-Proton unstoppable

Honours in the GTE Am class went to the #77 Dempsey-Proton Porsche crew of Julien Andlauer, Christian Ried and Matt Campbell, by a little under two minutes over the #54 Spirit of Race Ferrari.

The #77 car assumed control of the class in the early hours, with Campbell and Andlauer able to build the team's lead over the course of Saturday evening and bronze-rated Ried keeping the gap to the chasing Ferraris relatively stable.

Leading the charge in the morning hours was the #85 Risi/Keating Ferrari, but any hopes of closing down the #77 Porsche ended when Ben Keating went off at Mulsanne corner in the 22nd hour.

That allowed the #54 Spirit of Race Ferrari driven by Giancarlo Fisichella, Thomas Flohr and Francesco Castellacci to snatch the runner-up spot, with Keating and teammates Jeroen Bleekemolen and Luca Stolz securing the final place on the class podium.

Aston Martin's hopes of a class win ended when Paul Dalla Lana hit the barriers in the #98 Vantage shortly after one-third distance, while Dempsey-Proton's second car, the polesitting #88, was eliminated when Matteo Cairoli smacked the tyre wall at the Ford chicane in the morning hours.

2018 Le Mans 24 Hours results: