Max Verstappen had been unbeaten in qualifying since the Monaco Grand Prix in May, but Hamilton ended that run to secure the first pole of the year for Mercedes by the slender margin of 0.003s.
Hamilton's record-extending 104th F1 pole was also his first since the 2021 Saudi Arabian Grand Prix, with the elated seven-time champion remarking that ending his lengthy drought made it feel "like the first time".
Verstappen had to settle for second after complaining that a lack of balance made his Red Bull feel "all over the shop", while similarly disappointed was Lando Norris in third after giving up just 0.085s to Hamilton.
Behind Oscar Piastri, who made it an all-McLaren second row, Alfa Romeo's Zhou Guanyu recorded a best-ever starting position of fifth after a strong day for the Sauber-run squad.
The Chinese driver also topped Q1, the preliminary session run on the hard tyres as part of F1's alternative tyre allocation trial, with teams required to use specific compounds for each qualifying session.
However Carlos Sainz believes Ferrari lost out as a result as he missed the Q3 cut in 11th, while several other drivers have lamented that it has resulted in fewer laps completed during free practice which risks short-changing fans.
Another driver unhappy after qualifying was Hamilton's team-mate George Russell, who was left to lament that Mercedes had taken too much risk in only fuelling his car for one flyer at the end of Q1 as he ended up 18th.
Daniel Ricciardo marked his F1 return at AlphaTauri after replacing the ousted Nyck de Vries by outqualifying Yuki Tsunoda and will start 13th.
Source: Autosport