Mercedes headed into qualifying on the back foot with both drivers struggling for pace around the streets of Baku throughout practice on Friday and Saturday morning.

But the combination of using extra warm up laps, and a switch to a lower downforce-spec rear wing, helped Hamilton extract performance from his car in qualifying.

F1 Baku 2021 | FP3 - qualifying results | Azerbaijan Grand Prix

The seven-time world champion benefitted from gaining a tow running behind Mercedes teammate Valtteri Bottas during the first runs of Q3 to seal second place on the grid, two-tenths behind surprise pole sitter Charles Leclerc.

“The lap was okay,” Hamilton said. “I think we definitely weren’t expecting that.

“This is such a monumental result for us, because we’ve been struggling like you couldn’t believe all weekend.

“You can see it, but we kept out composure and continued to have difficult conversations in the background, kept challenging one another and just never taking “no” for an answer.

"We’ve moved around and made so many changes over these two days, which is chasing your tail. It’s been so difficult, but I think the work overnight and then typically between the sessions was amazing.

“I’m really proud of everyone for keeping positive. To be up there and so close to these guys is a great, great result.”

Hamilton praised the hard work of his Mercedes team to make the impressive recovery effort possible, having been facing the prospect of another disastrous weekend in the title race.

“It’s just crazy trying to get these tyres working and trying to find the envelope for this car,” he added. “It’s like the biggest challenge I think that we’ve had in a long time, to understand what the car really wants.

“She’s not been happy all weekend. It’s been a bit of a disaster, so for us to be up here and even for Valtteri to be in the top 10, that’s a massive leap and that’s just really down to great, great teamwork.”

And Hamilton hopes to be even more competitive on Sunday, with the Briton producing some promising long run pace during the race simulations on Friday afternoon.

“Our race pace is a lot better than our single lap pace,” he said.

“We’re miles off in a single lap and a lot closer in race pace. We don’t understand why, but I’d like to think hopefully we’re in that same position so we can take the fight to these guys [Ferrari and Red Bull] tomorrow.”