Nico Rosburg landed a huge psychological blow in pursuit of the world drivers' championship by landing pole position for the British Grand Prix after ousting Mercedes team-mate Lewis Hamilton at the last.
Hamilton was fastest through the three practice sessions and appeared destined to start his home grand prix on the front row after leading for much of Q3, only to refrain from doing a final flying lap and seeing the world championship leader Rosburg take his fourth pole of the season.
Red Bull's Sebastian Vettel joins the German on the front row, with McLaren's Jenson Button in third in his best qualifying position of the season.
Nico Hulkenberg and Kevin Magnussen will start fourth and fifth respectively while Hamilton begins in sixth despite dominating for much of the weekend and faces an uphill task to cut Rosburg's 29-lead in the championship.
Amid the changeable conditions at Silverstone, which included light rain throughout the circuit, several teams endured problems with tyre choice in the opening-qualifying sector.
And such conditions saw Williams pair Felipe Massa and Valtteri Bottas, who were on the front row in Austria and Ferrari duo Kimi Raikkonen and Fernando Alonso, who spun on his quick lap, all knocked out in Q1.
The inclement conditions continued to vary through Q2, but with three minutes remaining teams reverted to slick tyres to help edge into the top 10 shoot-out.
Briton Max Chilton, with a five-place grid penalty to come, was among those to drop out alongside fellow Marussia team-mate Jules Bianchi while Esteban Gutierrez crashed out despite enjoying impressive pace in the three practice sessions.
More rain mid-way through the final session caught plenty of teams out but didn't prevent Hamilton, whose car had excelled in the dry this week, setting the fastest time ahead of Rosburg and Perez.
But as the rain continued to fall, all teams withdrew in order to allow the track to clear up and with Hamilton going back to the pits, Rosburg took advantage of a drier third sector by taking pole position ahead of Vettel and home favourite Button.