Alonso, a double Formula 1 world champion, was the star turn as he became the sixth driver to complete the Monaco-Le Mans double after Tazio Nuvolari, Maurice Trintignant, Bruce McLaren, Jochen Rindt and Graham Hill.
"Le Mans once a year is not enough!"
The Spaniard shared the number eight TS050 hybrid with Swiss driver Sebastien Buemi and Japan's Kazuki Nakajima, who had taken pole position on Thursday and drove the final stint to the chequered flag.
That put Alonso's number eight auto more than two minutes - two thirds of a lap - behind and apparently facing an uphill struggle to get back into contention.
It seemed to be a case of "oh no, not again" for Toyota when Kamui Kobayashi in the number 7 vehicle slowed down to 80km/h with what seemed like a fueling problem heading towards the end of the race.
Toyota's closest challengers were the two Rebellion Racing cars which finished 12 laps back.
In the 16th hour of the race, Nakajima retook the lead and the number eight vehicle was in control for the duration.
Melania Trump 'hates' to see families separated; Laura Bush calls policy 'cruel'
Melania Trump is calling on America to be "a country that governs with heart" in a rare intervention into political debate. But White House officials' comments Monday morning gave no indication they are considering altering the policy.
Nakajima - who had clinched the pole position - finished in the vehicle, the Japanese driver enjoying a moment of redemption after a technical problem cruelly denied him and Toyota victory in the closing stages two years ago.
Jenson Button, the 2009 F1 world champion, was competing in the non-hybrid LMP1 class for the Russian SMP team.
In an era when modern drivers tend to specialise in one category, such is the demand of the individual championships, that it would be a remarkable achievement for Alonso.
The Spaniard left Ferrari at the end of 2014 having lost faith in their ability to deliver a title-winning auto, only to find that McLaren-Honda were in far worse shape.
The triumph, expected after champions Porsche withdrew a year ago, came at the 20th attempt for Toyota who became only the second Japanese manufacturer to win the world's greatest endurance race after Mazda in 1991. In 2016, Nakajima himself was in the lead Toyota about to cross the finish line, but with five minutes to go in the race a small hardware failure brought the auto to a dead stop in the final lap.
Alonso's hopes had appeared to dim as the race entered the early hours, with his vehicle two minutes adrift of the sister Toyota after a stop-go penalty.
There has been speculation that a Le Mans win could hasten the 36-year-old's departure from Formula One, with McLaren still a long way off the podium.