A brilliant lap in the final seconds gave him a fourth pole in five races, with the Briton 1.053 seconds quicker than Red Bull’s Daniel Ricciardo in third.
Right at the end I managed to get absolutely everything out of the car
Williams’ Valtteri Bottas and Lotus driver Romain Grosjean were fourth and fifth ahead of Ferrari duo Kimi Raikkonen and Fernando Alonso, with defending world champion Sebastian Vettel 10th.
“It’s been a tough day,” Hamilton said. “Nico has been driving really well so I didn’t know whether I’d be able to get it. But right at the end I managed to get absolutely everything out of the car.
“Yesterday [Friday] I had such a great day and I was really happy with the car. Often when things are that good you don’t want to change much, but we changed a couple of small things here and there.
“Today the track went down [in pace] and the car was a real handful. Lots of oversteer, very inconsistent corner to corner and once you’re in qualifying there is nothing you can do.
“So that’s why we made some changes [during qualifying]. I was struggling to put a lap together but in the end I made it by the skin of my teeth. I tweaked the diff settings a little bit and drove the car a little bit differently.”
Rosberg said: “Very disappointed, I don’t enjoy coming second to Lewis. In the end it was a good lap from me, and Lewis just did a better job. That’s the way it is.
“It’s still all to play for tomorrow. It only takes a good start and I’m in the lead again.”
1. Lewis Hamilton Britain Mercedes-Mercedes 1m 25.232s
2. Nico Rosberg Germany Mercedes-Mercedes 1m 25.400s
3. Daniel Ricciardo Australia Red Bull-Renault 1m 26.285s
4. Valtteri Bottas Finland Williams-Mercedes 1m 26.632s
5. Romain Grosjean France Lotus-Renault 1m 26.960s
6. Kimi Raikkonen Finland Ferrari-Ferrari 1m 27.104s
7. Fernando Alonso Spain Ferrari-Ferrari 1m 27.140s
8. Jenson Button Britain McLaren-Mercedes 1m 27.335s
9. Felipe Massa Brazil Williams-Mercedes 1m 27.402s
10. Sebastian Vettel Germany Red Bull-Renault no time Q3
11. Nico Hulkenberg Germany Force India-Mercedes 1m 27.685s
12. Sergio Perez Mexico Force India-Mercedes 1m 28.002s
13. Daniil Kvyat Russia Toro Rosso-Renault 1m 28.039s
14. Esteban Gutierrez Mexico Sauber-Ferrari 1m 28.280s
15. Kevin Magnussen Denmark McLaren-Mercedes no time Q2
16. Jean-Eric Vergne France Toro Rosso-Renault no time Q2*
17. Adrian Sutil Germany Sauber-Ferrari 1m 28.563s
18. Max Chilton Briton Marussia-Ferrari 1m 29.586s
19. Jules Bianchi France Marussia-Ferrari 1m 30.177s
20. Marcus Ericsson Sweden Caterham-Renault 1m 30.312s
21. Kamui Kobayashi Japan Caterham-Renault 1m 30.375s
22. Pastor Maldonado Venezuela Lotus-Renault no time Q1
MORE: The latest football news
MORE: The latest tennis news
BIOGRAPHY: Marcus Rashford