Lewis Hamilton turned it on at the right time to qualify on pole position for the Austrian Grand Prix.
The reigning champion had not topped a session all weekend at the Red Bull Ring but tuned in perfectly to beat Mercedes team-mate Nico Rosberg into second place - with both drivers spinning on their final attempts.
Hamilton, taking his seventh pole position in eight races this season, set a best time of one minute 08.455 seconds and was two tenths of a second clear of Rosberg - with the Ferrari of Sebastian Vettel third.
Hamilton's best effort came on the first run in Q3 before he ran wide on his last attempt - with Rosberg also skidding off to ruin his hopes of leapfrogging his title rival.
Hamilton had looked uncomfortable with the set-up of his car for much of the weekend as both Rosberg and Vettel got the better of the Brit at different stages.
He was 13th in a changeable first qualifying session and only squeaked through by three-tenths of a second and admitted he thought his spin at turn one had cost him pole position.
"It was quite a difficult qualifying session," he said.
"I was grateful that I got my best lap in early in Q3 - I was pushing for that bit extra and just locked the rear. I wasn't particularly concerned, I was trying to look after the car. Naturally, afterwards I was like 'I have probably lost it'."
He kept it because Rosberg also went off on the final corner of a lap that looked like challenging Hamilton's best.
"I'm not sure (what happened)," the German said of his spin.
"I went on the astroturf in the second to last corner, maybe it was a bit wet or I was pushing too hard. Lewis was two-tenths up on my time and that lap I was exactly two-tenths up. It is a very challenging track and easy to make mistakes."
Another fastest time for Hamilton means Mercedes have not been knocked off pole position since this race a year ago, when Williams locked-out the front row.
This time 2014 pole-sitter Felipe Massa was fourth behind Vettel's Ferrari, with team-mate Valtteri Bottas back in sixth as the Force India of Nico Hulkenberg split the Williams.
Max Verstappen qualified seventh after an impressive afternoon from the Toro Rosso teenager, with Daniil Kvyat eighth for Red Bull - although he will take a 10-place grid penalty.
Sauber's Felipe Nasr was ninth, with the Lotus of Romain Grosjean sitting out the final session due to technical problems.
Pastor Maldonado's Lotus was the closest to making it through to the top-10 shoot-out but the Venezuelan could only qualify 11th.
The second Sauber of Marcus Ericsson was next with Carlos Sainz down in 13th despite impressing earlier in the hour.
Daniel Ricciardo's poor weekend at Red Bull's home grand prix was compounded as he could only go 14th - with a 10-place grid penalty also to be applied.
Fernando Alonso was last in the second session but his McLaren will take a 25-place penalty after engine and gearbox changes.
With the early rain leaving some parts of the track wet, the majority of the field started the first qualifying session on intermediate tyres.
They soon dried out the circuit and reverted to the dry-weather rubber and, with the lap times tumbling, it was Raikkonen who was the big-name casualty.
The Ferrari man could not hook up a quick enough lap to make it through to the second part of qualifying as he joined Sergio Perez of Force India, Button's McLaren and the Manor pair of Roberto Merhi and Will Stevens in the bottom five.
Button - who, like Alonso, was hit with a 25-place grid penalty having had new components fitted to his car, had briefly held top spot but slipped out as the drying track levelled the playing field.
"Those conditions are always good fun," he told Sky Sports.
"It is not just about the car you're driving and the performance, you have to find your own feet. When the circuit dries it is basically about how quick the package is. I will have a 10 second penalty, I will come in during the first few laps of the race."