Red Bull's Daniel Ricciardo took a sensational pole position for the Monaco Grand Prix ahead of Mercedes' Nico Rosberg and Lewis Hamilton.
Ricciardo beat Rosberg by 0.169 seconds as Hamilton salvaged third after a troubled session in which he suffered an engine problem in final qualifying.
The issue meant Hamilton only had one run to everyone else's two and could manage only 0.320secs off the pace.
Ferrari's Sebastian Vettel took fourth ahead of Force India's Nico Hulkenberg.
More trouble for Hamilton
Hamilton had to be wheeled back to the Mercedes garage after his car lost power in the pit lane at the start of the top 10 shoot-out.
But he was actually fastest of all in the first sector on his final lap of the session, after doing three build-up laps to try to get the ultra-soft tyres in the best condition.
However, his pace dropped off in the final two sectors and he was left to rue yet another technical problem affecting his season.
He is 43 points behind Rosberg in the championship, after problems affected his results in three of the first four races - all of which the German won - before the two crashed out together on the first lap in Spain two weeks ago.
Hamilton said: "I don't really know what to say right now. It was a difficult qualifying but the good thing is I did get out to do a lap, so it is not as bad as some of the races have been.
"I'm grateful to be up in third and I will do what I can to salvage what I can from today's result."
What a place to get your first pole
Ricciardo's pole time, the first of the Australian's F1 career, marks an impressive debut for a new, upgraded Renault engine which is worth an extra 30bhp.
It is still not quite as powerful as Mercedes' engine but it is close enough for the excellence of the Red Bull chassis in slow corners to make up the difference.
Allied to Ricciardo's liquid but exuberant attacking style, it made for a formidable combination around the demanding Monaco street circuit.
"I knew coming into the weekend we had a strong chance and it looked good from Thursday," Ricciardo said.
"I feel like I have been driving well the last few races but hadn't got maximum reward. I came into the weekend feeling I could be in this position now.
"It feels good. I have always enjoyed this place. We have a good package and it is nice to make the most of it."
Ricciardo has chosen an alternative strategy for the race - he will start the grand prix on the slower super-soft tyre, using the ultra-soft in the second stint.
That means he can run longer before his pit stop, which Ricciardo said "gives us some more options". However, rain is expected, which would make dry-weather strategy calculations redundant.
Ah, Verstappen is human
Ricciardo's team-mate Max Verstappen crashed heavily early in the first session and will start 21st.
The Dutchman, who won the last race in Spain on his debut for Red Bull, misjudged his entry to the second part of the Swimming Pool complex and clouted the barrier on the inside with his right front wheel.
That broke his front suspension, and threw him across the track, over the kerbs of the second part of the corner and into the wall.
The 18-year-old said: "Of course that is not the way you want to start for tomorrow.
"I turned in a bit too early, broke the suspension and then couldn't recover from it. It's a case of misjudgement - that is all. A miscalculation - I just misjudged the grip a little bit."
More swear words from frustrated Vettel
Although fourth appeared respectable for Ferrari, Vettel was 0.9secs off the pace and was fuming in the car over the team radio afterwards.
He swore and told the team: "This car's got worse."
Team-mate Kimi Raikkonen was sixth, but will start 11th because of a five-place penalty for a gearbox change.
Further down the field, McLaren's pre-event prediction that they would get both cars into the top 10 fell flat.
Fernando Alonso did manage it, qualifying 10th, but team-mate Jenson Button was only 13th.
McLaren were surprised by the pace of the Force India and Toro Rosso cars, who they had not expected to be so quick.
Toro Rosso's Carlos Sainz was seventh, ahead of Force India's Sergio Perez and the second Toro Rosso of Danill Kvyat.