Mercedes has been vulnerable in Singapore through its all-conquering seasons in F1's V6 turbo-hybrid era, and faded in final practice after running Ferrari close on Friday.

However, Hamilton produced a superb lap in the final part of qualifying to claim his seventh pole of the season by three tenths of a second, with title rival Sebastian Vettel in third.

"That was a hard qualifying session," Hamilton said. "That lap felt like magic. I don't really know where it came from."

Hamilton admitted he was "a bit nervous" heading into qualifying after trailing Ferrari by half a second in final practice.

He reckons the mistake on his second flying lap shows how good the initial effort, a 1m36.015s, was.

"I was thinking there's no way I can find half a second," he said. "In that last session it was about pulling all those bits in practice and trying to put it into a perfect puzzle – 99.9% of the time it doesn't go right.

"But that lap, I didn't have wheelspin, I didn't have a snap anywhere, the car was just underneath me and I managed to maximise it at pretty much every corner.

"I can't remember one where I thoughts I could do more.

"The second lap I tried to go that little bit more, brake half a metre later, it was too much, the car wasn't going to have it.

"I feel I got everything possible in that first lap."

Hamilton and his teammate Valtteri Bottas started FP3 on soft tyres and tried to get through to Q2 on ultrasofts, which Hamilton believes was a disadvantage as Mercedes' rivals were able to conduct more preparation on the hypersoft tyre.

However, an engine problem for Max Verstappen prevented the Red Bull driver from improving on his second run anyway and Vettel ended up a massive 0.613s adrift.

"The guys have been flat out to try to bring little bits here and there," said Hamilton. "We knew coming to this race that the Ferrari's and the Red Bulls would be really hard to beat.

"This is an incredible moment for us to be on pole here considering the circumstances."

Mercedes team boss Toto Wolff hailed Hamilton's effort as "the most amazing lap I've ever seen" and said it was "stardust", with Bottas 0.687s slower in fourth.

"I want to say thank you to Brackley and Brixworth," Wolff told Channel 4. "They've done such an amazing job to make us competitive in Singapore. Who would have thought that?

"It's the first time we've really conquered it [the Singapore circuit] in the last years in that way.

"I'm over the moon. Whatever the race result we've made a step forward in understanding what the car needs and that makes me happy."