Red Bull's Max Verstappen pipped theFerrari of Charles Leclerc to pole position at the Austrian Grand Prix.
Verstappen snatched pole back after the world champion's earlier fastest time had been beaten by Leclerc and his team-mates.
The Dutch was just 0.029 seconds quicker than Leclerc, while Sainz was 0.082 seconds off the pole.
George Russell was fifth and Lewis Hamilton was tenth.
Verstappen, who was serenaded by thousands of fans from his home country, looked as if he had missed out as he headed into the final sector of his final lap.
At that point, he was not improving his time, and he was behind both Leclerc and Sainz, who were both doing so.
But Verstappen was still pushing, and although he was slower than Leclerc through the final sector, he was quick enough to grab pole.
Red Bull'sSergio Perez is under investigation for exceeding track limits.
The session establishes the grid for the sprint race and the main grand prix on Sunday.
The points for the sprint are eight for the winner down to one for eighth place, and Leclerc really needs to regain some ground on Verstappen in Austria to revive his title hopes.
The Monegasque has lost four times in five races through engine failures and strategy errors and is now 43 points behind Verstappen.
He only wanted a clean race after his difficult period.
Hamilton was in the running for a place mixing it with the Red Bulls and Ferraris after setting third fastest time in the second part of the race.
But the seven-time champion made a most uncharacteristic mistake, losing control on his first flying lap in the final part of qualification.
He lost the rear when he was a little wide. He slid across the gravel trap to try and catch it.
The red flag was raised while the barrier was repaired.
Russell made a mistake at Turn 10 when the session was restarting and he was the first driver out.
He slid sideways across the run-off and into the barrier as he turned in. But, unlike Hamilton, he had managed to put a lap in on his first set of tires, and he held on to fifth place as everyone else went for position in the final two minutes.
It will take Mercedes a long time to fix both cars.
Behind Russell, Alpine's Esteban Ocon was sixth, followed by Kevin Magnussen and Mick Schumacher, and Alpine's Fernando Alonso and Hamilton.
There was a performance from Alex Albon in the updated Williams in 12th place, while McLaren were struggling.
In the first session he was knocked out in 16th place, again struggling for pace.
Lando didn't fare much better. The British driver was able to make it into the second part of the race, but a brake problem kept him out of the top 15.