The 28-year-old Briton, in his Mercedes, grabbed his fifth pole of the year and 31st of his career with a late lap that saw him clock a best lap in two minutes and 1.012 seconds.
This came just a second after Australian Mark Webber and his Red Bull team-mate defending world champion German Sebastian Vettel had gone successively fastest with laps of 2:01.325 and 2:01.200.
Hamilton's lap delivered a final stunning moment of drama at the very end of a qualifying hour packed with incident and shocks as sweeping rain produced rapidly-changing conditions.
It brought Hamilton his seventh front row start of the season on a memorable afternoon from start to finish.
More From This Section
"It was a good job by the team," said Hamilton, who is fourth overall 44 points in arrears of Vettel.
"I was surprised when I came across the line. I went wide in Turn One and my dashboard told me I was three seconds down and then it was four seconds and then six.
"So I didn't know what was going on, but I kept pushing.
Mercedes chief Ross Brawn was understandably delighted.
"You try and put things in place and it's really up to the drivers to see if they can make the most of it.
"We were just on the limit of being the last car. It did work out for us and with the track drying, Lewis did a great job. He really is settling in well to the team. And he is a delight to work with.