The Spanish driver, together with teammates Kazuki Nakajima of Japan and Sebastien Buemi of Switzerland, completed 388 laps in their Toyota hybrid vehicle, two more than Mike Conway, Kamui Kobayashi and Jose Maria Lopez in the other Toyota hybrid.
The win was achieved by Toyota's number 8 vehicle piloted by the experienced duo of Kazuki Nakajima, and Sébastien Buemi together with newcomer Fernando Alonso who scores outright victory in the race at the first time of asking!
Expected to dominate the 86th edition of the race, as the only major manufacturer in the top LMP1 category after champions Porsche withdrew previous year, Toyota's victory came at the 20th attempt.
Nakajima - who, like Buemi, is a former F1 driver - put Alonso's number eight vehicle on pole position and the lead see-sawed between it and the number seven machine shared by Briton Mike Conway, Japanese Kamui Kobayashi and Argentine Jose Maria Lopez for much of the first half of the race. 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.
Toyota's closest challengers were the two Rebellion Racing cars which finished 12 laps back.
Victory was theirs to lose - but Toyota have been burnt before, losing victory on the final lap two years ago.
Toyota Gazoo Racing technical director Pascal Vasselon says he was "surprised" by the pace shown by the non-hybrids in the race, which showed reduced performance compared to qualifying.
Alonso skipped last year's Monaco Grand Prix to tackle the Indianapolis 500, but was forced to retire with an engine failure while battling for the lead.
But in a series of stints in the dead of night, Alonso clawed back the deficit and put the number eight auto right back on the tail of the number seven.
The result was effectively settled when Kobayashi had to serve two penalties for exceeding the fuel allowance, and for driving too many laps in a stint.
But in the end, both cars made it to the finish, to complete the company's dream result - a one-two, with Alonso's auto the victor. "I'm not used to watching my vehicle racing - I'm normally in it".
Their work on reliability over the winter has paid off with no sign of the mechanical failures that had plagued the team since 2012.
"I didn't join just for the Le Mans experience", he told reporters at the Sarthe circuit.
There have been questions about whether it was a demonstration rather than a race, because of the obvious promotional benefits for all involved if Alonso won.
"I can't really describe it", said Buemi, who was also Nakajima's team mate in 2016, when asked how it felt to win at last.
Either way, the win is likely only to enhance his status as one of motorsport's iconic historical figures. Just the Indy 500 left for Alonso, then...
These questions will be hanging over him when he returns to his F1 role with McLaren at next weekend's French Grand Prix.