The Briton locked out the front row for Mercedes with teammate Valtteri Bottas, but it was his strategy to deprive title leader Max Verstappen of a chance to better his time that might prove most important to notching up his ton and returning to the top of the points table for the midseason break.
Having taken provisional pole with his first lap, Hamilton was released from his garage for the final laps just ahead of Verstappen, ensuring he could control the pace of the warm-up lap and run the session to his rhythm.
It cost him an opportunity to improve his own time, but it had the desired effect, with Verstappen finding only a paltry 0.1 seconds and relegating him to third on the grid.
It was the culmination of a comprehensive qualifying session for Hamilton, who will not only start from pole with the support of Bottas alongside him but also have the strategic advantage of using the more durably medium tyre, as will his teammate.
Neither Verstappen nor teammate Sergio Perez, who will start from fourth, had the performance to use the slower but stronger tyre in Q2 and so will start on the delicate softs for the first stint of the race.
It was a stark turnaround in form for Mercedes, which had taken a beating from Red Bull Racing over the last six weeks, particularly given the Hungaroring had been expected to favour the energy drinks-backed team.
“I think it’s been an amazing teamwork from everyone this weekend, Valtteri included, just trying to push the car forwards, developing constantly,” Hamilton said. “The guys back at the factory just have not left any stone unturned, so it’s been amazing to see everyone coming together and rallying up and pushing forwards.”
Verstappen, who leads Hamilton by only eight points in the drivers standings, was feeling pessimistic about his chances of overhauling Mercedes in the race.
“We’ll find out tomorrow,” he said. “It’s going to be really hot, so naturally the soft tyre will not last as long as the medium, but it will give us an opportunity off the line.
“We’re still there n P3, and we’ll see what we can do. But so far not what I want.”
AlphaTauri’s Pierre Gasly qualified fifth ahead of McLaren’s Lando Norris and Ferrari’s Charles Leclerc in a preview of an expected tight midfield scrap.
Alpine teammate Esteban Ocon and Fernando Alonso were closely matched in eighth and ninth, and Aston Martin’s Sebastian Vettel will line up 10th.
Daniel Ricciardo was again outqualified by McLaren teammate Norris, but the Australian will at least have the benefit of free tyre choice from just outside the top 10.
Lance Stroll will start 12th for Aston Martin ahead of Alfa Romeo pair Kimi Raikkonen and Antonio Giovinazzi.
Carlos Sainz was knocked out in 15th with a heavy crash at the final corner of his first hot lap of Q2. The Spaniard asked too much of his rear tyres, losing the back of his car and sliding into the barriers.
Yuki Tsunoda will start alongside him in 16th.
Williams drivers George Russell and Nicholas Latifi will start 17th and 18th ahead of Haas teammates Nikita Mazepin and Mick Schumacher. Schumacher was unable to set a time after a heavy crash in final practice left too little time for the team to make repairs.