Max Verstappen was in pole position for the British Grand Prix until Carlos Sainz snatched it from him.
After topping the first two sessions, Verstappen appeared to be the favorite for pole.
At the end of the top 10 shootout, Sainz was in front by just 0.072 seconds, with Leclerc in third.
Lewis Hamilton was in fifth place.
Sainz giggled in disbelief over the team radio as he was told he had taken pole. He said how difficult it had been.
After pushing Verstappen all the way for victory in Canada, it was another strong performance from the Spaniard.
"I was struggling with the standing water and it was easy to lose the car and lose the lap," he said.
It was a bit of a surprise that it was pole position.
A yellow flag forced the Dutch driver to back off on his final lap and deprive him of the chance to snatch pole back from Sainz.
You had to be on the track at the right time because it was raining.
The car worked well. It is a bit of a lottery in the third quarter. I got a bit hindered on my final lap with the yellow flag but to be on the front row is good for us and we have a good race car.
It was costly for Leclerc as it came on his final lap and he was trying to overtake Sainz.
Leclerc wished Carlos a happy birthday. I spun in the last lap. I didn't deserve to be on pole because I didn't put everything together fast enough.
After seeing his early-season title race lead turn into a 49-point deficit to Verstappen, Leclerc admitted that he needs to win on Sunday to revive his title hopes.
Mercedes appeared to have made a step forward after introducing some improvements to their car.
Hamilton was competing with Verstappen and Leclerc, as well as team-mate George Russell, to get the pole position.
Hamilton was a second off the pole after both slipped back in the final seconds of qualification.
I was having a lot of fun out there. I knew I had to fight for the front row. I was told by the team to back off on the second to last lap and push on the last lap, but it rained more on the last lap and it was slower. That's going on.
Russell said he had the pace to be fourth or fifth but had made a mistake on his last lap and was in eighth.
Fernando Alonso followed up his front-row qualification in the Alpine in Canada with another strong showing, while Lando Norris did the same in the McLaren.
Valtteri Bottas was down in 12th and Zhou Guanyu was ninth.
The man in 10th place did a great job.
Despite being deprived of the major car upgrade that was put only on Alex Albon's car, Nicholas Latifi equalled his best ever qualification performance in the Williams.
The man was knocked out in the first session.