The New Zealander took his second pole of the year after the Le Mans 24 Hours in June with a 1m46.800s lap aboard the #8 Toyota GR010 HYBRID to knock Peugeot’s Paul di Resta off the top spot in qualifying by eight tenths.
Di Resta posted a 1m47.610s aboard the #93 Peugeot 9X8 to just shade Mike Conway’s 1m47.738s in the #7 Toyota before Hartley set his time.
The point for pole won by the #8 Toyota moves Hartley, Sebastien Buemi and Ryo Hirakawa clear of the Alpine-Gibson A480 crew at the head of the championship going into Saturday’s Bahrain 8 Hours.
The Toyota drivers and the Alpine trio of Nicolas Lapierre, Matthieu Vaxivierre and Andre Negrao were tied on 121 points prior to qualifying.
Hartley said: “I found the right balance in sector 1 and I think I really got the peak of the tyres.
“I must have got them right in the window on the out lap.
"The track gripped up more than expected and I'm definitely happy with my lap."
Gustavo Menezes took fourth position in the second of the Peugeots with a 1m48.334s, which was seven tenths down on team-mate di Resta’s time.
Vaxiviere brought up the rear of the Hypercar class in the grandfathered LMP1 Alpine with a 1m48.343s despite making a second run on a fresh set of tyres.
Norman Nato grabbed pole in LMP2 right at the end of the 10-minute prototype qualifying session for the Realteam by WRT squad.
The Frenchman improved to a 1m50.330s on a second set of tyres aboard his ORECA-Gibson 07 to knock Will Stevens off the pole in the championship-leading Jota ORECA.
Stevens’ 1m50.467s set on his first run stood as the second best time, which was just three hundredths up on Filipe Albuquerque’s 1m50.497s in the #22 United Autosports ORECA.
The Portuguese improved on this second run to a 1m50.445s to go quicker than Stevens, but lost the time to a track limits infraction.
Porsche driver Gianmaria Bruni took the last ever pole position in GTE Pro. The Italian jumped to the head of class times in the #91 Porsche 911 RSR with a 1m56.143s set on his second flying lap.
That gave him a margin of just under three tenths over Antonio Fuoco, whose 1m56.419s sealed second position for the #52 Ferrari 488 GTE Evo.
Michael Christensen took third in the #92 Porsche has he sought to take the point for pole position.
The extra point would have closed the gap on championship leaders James Calado and Alessandro Pier Guidi to just 10 points and meant Christensen and Estre could seal the title with class victory no matter where their Ferrari rivals finished.
Christensen was initially fastest with a 1m56.439s before just losing out to Fuoco. He pitted for a fresh set of tyres and improved to a 1m56.306s to reclaim second, before the time was deleted for a track limits violation.
Pier Guidi took fourth on 1m56.687s after a spin, while the Chevrolet Corvette C8.R in Nick Tandy’s hands brought up the rear of the five-car class.
Pole position in GTE Am went to Sarah Bovy in the Iron Dames Ferrari. Her 1m59.186s shaded Ben Keating in the TF Sport Aston Martin Vantage GTE by half a second.
The Bahrain 8 Hours begins at 14:00 local time on Saturday.