Ricciardo had signaled his intent with the fastest time in Thursday's final practice and — with Hamilton's mechanics working frantically on his car in the Mercedes garage — zoomed up the leaderboard with a time of 1 minute, 13.622 seconds.
Ferrari driver Sebastian Vettel was a disappointing fourth after posting the fastest time in the morning's third and final practice run.
Ricciardo let out a scream of joy when he realized he had secured the first pole of his career, and the Australian driver will be confident of his fourth career win — having won three races in his debut season for Red Bull in 2014.
"I will sleep easier tonight knowing I set out what I tried to do, getting my first pole," Ricciardo said. "Monaco is a driver's circuit. That extra bit of confidence and commitment goes a long a way."
Rosberg, the runaway championship leader, will need a strong start on Sunday to stand a chance of a fifth win in six races this season. But he is well placed to extend his 43-point lead over Hamilton, whose miserable season is in stark contrast to last year, when he largely cruised to a second straight title and third overall, wrapping it up with three races to spare.
With Monaco being arguably the hardest track in F1 to overtake on, the British driver is all but resigned to a ninth race without victory — unless there is a drastic change in weather.
"Today was the crucial day so tomorrow's just another day. I don't really expect much from tomorrow," said Hamilton, whose only win in Monaco was in 2008 with McLaren. "If the car keeps going, I'll be fighting as hard as I can with these guys. ... Hopefully it rains, that would be pretty amazing."
Ricciardo's pole is particularly sweet for Red Bull — which came very close to cutting ties with engine supplier Renault last season as the team struggled for form.
"From the start of the season the car is getting better and better. I had a power unit upgrade here and it feels really good, you can feel it pull up the hill," Ricciardo said. "I feel it's been a long time coming this, I feel it should have come sooner but obviously I'm happy that I've done it."
Ricciardo last podium was 12 races ago — second at the Singapore GP — and he has finished fourth four times this season, including at the Spanish GP two weeks ago when his 18-year-old teammate Max Verstappen became F1's youngest winner.
Verstappen's hopes of a repeat win all but ended early in qualifying.
The Dutchman was going through the swimming pool section when he lost control and his suspension seemed to break, sending him flying over the kerb and straight into the wall, heavily damaging his front wing.
"Maybe I underestimated the grip I had, turned a bit too early," said Verstappen, who was unharmed. "Then it all goes wrong."
That has been a familiar feeling for Hamilton with engine problems this season.
"Guys, guys. Something wrong with the engine," Hamilton lamented over team radio as his car stalled in the pit lane right at the start of Q1. "I've got no power."
His mechanics sprinted over to his car, rolling it back to the garage. They did well to get him back out on track, but he did not have enough time left to mount a serious challenge for pole.
"I was just accelerating and then I had losses of power all the way down the pit lane," Hamilton said, describing what happened. "I don't know what to say."
Meanwhile, Finnish driver Kimi Raikkonen finished in sixth place behind the Force India of German driver Nico Hulkenberg.
But Raikkonen was expected to be handed a five-place grid penalty following an unscheduled gearbox change on his Ferrari following the morning's practice.
The grid penalty arises because the original gearbox did not complete the six consecutive races required by F1 regulations.
Brazilian driver Felipe Nasr's qualifying lasted barely three minutes when he was undone by engine failure.