The Woking team got both Sainz and teammate Lando Norris into Q3, the first time it has had both cars in the top 10 shoot-out since 2017.

Sainz finished less than a second off pole position and less than a tenth behind the Red Bull of Max Verstappen, who qualified fifth in the first non-Ferrari and non-Mercedes car.

The Spaniard said it was impossible to imagine such a result given McLaren's form at the end of last year.

"Congratulations to all the team, because we got both cars in Q3, which is something that hasn't happened for a long time at this team," said Sainz.

"It shows we are working well, we are going in the right direction.

"A tough winter and the second half of last year trying to understand the problems with last year's car is now starting to pay off.

"We are learning, we are improving the car and today we are here, nearly as the best of the rest, which was unthinkable three or four months ago. We were half a second off this."

Sainz, who retired from the season-opening Australian Grand Prix, admitted he was at a loss to explain why McLaren was so close to the cars in front after lapping just half a second slower than the Mercedes.

"It's hard to understand why we are so close or why everything has tightened up," he said. "It's better, more fun for the spectators. I think today we nearly beat a Red Bull, and we were nearly two seconds behind last year.

"We beat a Red Bull, [Pierre] Gasly, actually. It's all a bit strange but that's better."

Norris made it into Q3 for the second grand prix in a row, qualifying in 10th position.

The rookie, who made mistakes on his fastest flying lap in Q3, said the result was a great boost for his team.

"To have both cars in Q3 is very positive for the team, we've taken some small steps forward," said the Briton. "It gives us a lot of confidence, for all of us.

"I made a couple of mistakes here and there, nothing big, a little lock-up into Turn 10 which is quite tricky. I pushed a little too much.

"It's still Q3, and I'm pretty happy with that."