After clinching victory in last weekend's race in Malaysia, Hamilton proceeded to dominate all three practice sessions in Bahrain, with Rosberg playing second fiddle.
But come qualifying at the Bahrain International Circuit it was the current championship leader who claimed his first pole since the Monaco Grand Prix last May.
The Bahrain race is being run at night, joining Singapore and Abu Dhabi in that regard on the current calendar, as part of the track's 10th anniversary celebrations.
Some 5000 floodlights arranged on 495 poles ranging in height from 10-45 metres provide illumination but so far it is Mercedes who have lit up the track, showing blistering pace none of their rivals have been able to come close to.
Hamilton, however, made a mistake on his final run, locking up at one point to hand the initiative to Rosberg, who claimed pole for the second consecutive time at this track.
Red Bull's Daniel Ricciardo was third-fastest but incurred a 10-place grid penalty following an unsafe release from a pit stop in Malaysia and will start 13th.
That means the drivers from fourth to 13th will move up a place, spearheaded by Williams' Valtteri Bottas, with Sergio Perez a superb fifth in qualifying in his Force India.
Ferrari's Kimi Raikkonen and Jenson Button in his McLaren were next up, followed by Felipe Massa in his Williams and the second McLaren and Ferrari of rookie Kevin Magnussen and Fernando Alonso respectively.
Red Bull's defending champion Sebastian Vettel qualified 11th-fastest just a week after qualifying on the front row at Malaysia. Behind the German came Nico Hulkenberg in his Force India, followed by Toro Rosso duo Daniel Kvyat and Jean-Eric Vergne, and Sauber's Esteban Gutierrez.
Lotus's Romain Grosjean could only manage 16th at a track where he finished third a year ago but the Frenchman was impeded on one of his runs by the Sauber of Adrian Sutil and the stewards were still investigating the incident last night.
It has been 16 races since Rosberg, winner of the season-opening race in Australia, was last on pole.
He said: "It has just worked well through the weekend, finding my way, making progress and getting through some issues.
"The challenge this weekend was that in free practice we ran in such hot conditions, and we sort of had to guess for the cold conditions [for qualifying].
"But it worked out well. I felt comfortable and got my laps together, so I'm very happy. I have good memories of this track, winning the GP2 championship here and starting my first race in F1. I enjoy coming here and again, today, it has suited me."
After the error on his final run, Hamilton insisted he was far from disappointed and praised Rosberg for pipping him to the top spot. "Congratulations to Nico who has done a great job this weekend,"the Briton said. "He is improving and picking up the pace."
On his mistake, Hamilton added: "I locked up. You can't always get it right, but generally I am happy for the team."
Ricciardo admitted he faces a battle to scythe his way through the field to gain a respectable points position.
"I'm really pleased with the performance," said Ricciardo. "At the moment it's the best anyone can do against the two guys alongside me.
"We've still some ground to make up on them, but I'm really pleased with qualifying. Unfortunately I don't stay at the front. I've a bit of work to do, and we'll move forward from there."