Russell and Mercedes had not looked competitive for much of qualifying, but a typically strong lap from the Briton on his final run vaulted him ahead of the Ferraris, whose promising pace through the weekend faded when it mattered.
He said a change in weather conditions had helped him improve. "We arranged for those clouds to come in and that made us go about 0.5secs faster so that was nice," Russell said.
Hamilton, who topped the second session of qualifying, ended up just 0.203secs from pole.
The seven-time champion said: "The lap was pretty decent at the end and then I lost a bit of time in the last corner, which probably would have put me on the front row or at least third.
"We're right on a knife-edge, other than that squeezed everything I could out of the car.
"I definitely feel a lot better in the car this weekend, this track is incredible and the crowd is amazing. But we needed just a little more from the car, another 0.1secs of performance to nudge us a little bit closer to the front guys."
Leclerc also said he had made a mistake at the end of his lap.
"Horrible," he said. "The pace was there for the front row but I didn't do the job when I needed to. I lost the car in the last two corners and lost a lot of lap time.
"But it has been the story of the season. I need to find back my rhythm in qualifying because I'm really struggling and I'm not putting everything together. I am very frustrated with qualifying, I know that in the race I am doing a good job."
Leclerc swore repeatedly at himself over the radio in frustration after finishing his lap, using so many words that were bleeped out when it was broadcast on social media after the session that it was impossible to tell what he said.