Hamilton, outclassed by Rosberg at the last race in Singapore, has been cast eight points adrift of his Mercedes team-mate after seeing him waltz to three successive victories.
But the world champion, inset, blew Rosberg away at the Sepang International Circuit yesterday to finish nearly half a second clear of the German.
Max Verstappen will start third with Red Bull team-mate Daniel Ricciardo fourth on the grid.
Rosberg has led virtually every lap since the summer break as he bids to prevent Hamilton from winning a hat-trick of consecutive championships.
And following his commanding win over an off-colour Hamilton at the Singapore Grand Prix a fortnight ago, the momentum appeared to firmly be on his side of the garage.
But Hamilton, who is only one win shy of his 50th in the sport, turned in a dominant display in the heat of Malaysia to seal what could be a crucial pole, and one the Briton will be desperate to convert into a much-needed victory.
Indeed Hamilton, who has struggled off the start-line this season, has converted only three of his seven poles into wins.
“A huge thank you to the team who continue to improve,” Hamilton said. “Great work coming into this weekend, and the car felt fantastic, but the lap could have been faster.”
Rosberg, who made mistakes on both of his timed runs during the 12-minute shoot-out for pole, said: “I would have come close but unfortunately I made a mistake in that last corner.
“So, second place – I have got to live with that – but as we know from this year second does not mean victory isn’t possible. I am optimistic about tomorrow.”
McLaren’s motorhome has been transformed into a pub this weekend to celebrate Jenson Button becoming only the third driver in Formula One history to compete in 300 races.
And nobody would begrudge the Briton for cracking open a beer in the so-called “Dog and Button” last night after he qualified an impressive ninth at a circuit where he recorded his first podium finish 12 years ago, and won en route to sealing the 2009 world championship.
His McLaren team-mate, Fernando Alonso, however, will start at the very back after serving a 45-place grid penalty following a raft of updates to his Honda engine.
It had been an encouraging weekend for Jolyon Palmer, but the British rookie will start only 19th this morning.
Palmer, whose Formula One future beyond this season appears bleak, made a number of errors on his final timed run and was the best part of half a second behind his Renault team-mate, Kevin Magnussen.
The Dane, who may also be turfed out by Renault after just one year, qualified five places ahead of Palmer in 14th.
Sebastian Vettel, who won here last year, qualified fifth ahead of his Ferrari team-mate Kimi Raikkonen in sixth.