Bernhard and his teammates triumphed in a close-fought battle with the sister Porsche 919 Hybrid driven by Andre Lotterer, Neel Jani and Nick Tandy during which the two cars were rarely separated by more than 10 seconds.
The two Porsches, racing in high-downforce configuration for the first time this season, swapped positions multiple times over the course of the six hours.
Lotterer appeared to have secured the victory over the final hour, pulling a 12s gap on Bernhard until the two cars made splash-and-dash fuel stops in the final 10 minutes.
Bernhard was stationery for 20s less in the championship-leading Porsche, which allowed it to take the victory in what was clearly an orchestrated move.
Toyota briefly took the fight to Porsche with the pole-winning #7 TS050 Hybrid, with Kamui Kobayashi leading to the first round of pitstops before handing over to Jose Maria Lopez.
The Argentinian driver was quickly passed by Hartley and then Jani, but remained in touch until the second fuel stops.
Lopez was unable to match the Porsches on his second stint on the tyres and dropped 20s before handing over the car to Mike Conway, with the #7 trio ending up more than a minute down at the flag.
Sebastien Buemi, Anthony Davidson and Kazuki Nakajima, winners of the opening two rounds of the WEC, finished a distant fourth after losing five laps right at the start of the race.
Fuel pump failure meant Buemi had to complete the formation lap on electric power before pitting for a replacement.