Sainz set the fastest time of 1 minute 40.983 seconds late in the third qualifying session to edge reigning Formula One champion Max Verstappen by just .072 seconds. It was the seventh pole in 10 races for Ferrari this season, though it was Sainz teammate Charles Leclerc on pole prior to Sainz's surprise run.
“I didn't expect that one,” Sainz told his team over the radio.
Leclerc will start third, ahead of Sergio Pérez in the second Red Bull.
Seven-time champion Lewis Hamilton qualified fifth for his home race as Mercedes seemed to have made progress with its problems of bouncing at high speed. His teammate George Russell was eighth.