The Mercedes driver had appeared to be on the backfoot against title rival Max Verstappen after the Red Bull ace dominated first free practice.
But Hamilton delivered when it mattered in the evening qualifying session, as Verstappen was left struggling with some unexpected understeer.
The seven-time champion edged out the current points leader by 0.075 seconds.
Reflecting on his performance, Hamilton said he had elected to make the most of F1’s late start to Friday action by having a last-minute run in the nearby Mercedes simulator before track action began.
“We had this morning free and I was like, ‘look, let’s not sit around and waste time. Let’s get to it,” he explained.
“So we did a practice session this morning in there. We are just trying to develop it [the car], trying to give the guys as much information as possible so as we’re developing the car, we’re squeezing absolutely every ounce of performance we’re missing. But it was holding together today, so I’m over the moon.”
Hamilton said Mercedes had focused on its own long-run programme in the morning session rather than chasing headline lap times like Red Bull.
And although his final Q3 effort was derailed by a slide on the entrance to the Club sequence, Hamilton’s first run was enough to take the top slot.
Lewis Hamilton, Mercedes W12
Photo by: Mark Sutton / Motorsport Images
“I don’t know what they were doing in there,” he said.
“They were very quick obviously in that practice session, but we were just staying focused on our job and trying to layer up.
“I was in the sim this morning, just to use it as a practice session, because it is the first time we’ve ever had a morning free.
“I just put in the time, just trying to give absolutely everything and leave no stone unturned.
“So that first lap was great. The second one was looking even better, but I just lost the back end in the last corner so my heart was in my mouth as I came across the line.
“But I could see the crowd and it was really reminiscent of my first pole here in 2007.”
Hamilton’s top time from the Friday session will give him pole position for F1’s first sprint qualifying event, which will decide the grid for Sunday’s main event.