Having struggled in all three practice sessions, finishing no higher than fifth, Mercedes driver Hamilton suddenly found the pace he needed to take the 70th pole of his career ahead of Kimi Raikkonen.
Vettel will start from last in the latest bitter blow for Ferrari. "We just didn't know if we were going to fix the issues or not. The Ferraris still looked like they were ahead," Hamilton said. "We had no idea how it was going to go today. Somehow we turned it around."
Max Verstappen qualified third ahead of Red Bull teammate Daniel Ricciardo, while Hamilton's teammate Valtteri Bottas was fifth. It was Hamilton's fourth straight podium in Malaysia, fifth overall and seemingly one of the toughest. He held a towel on his face for several moments and still seemed breathless before answering questions, his shoulders rising and falling slowly at one point as he took a long, deep breath.
"I didn't sleep well last night," the 32-year-old British driver said. "I don't really know where that lap came from, to be honest." There were heads in hands in the Ferrari garage as Vettel came back in the first part of qualifying, having not even set a time. At least Raikkonen saved face, finishing just 0.045 seconds behind Hamilton's time.
Raikkonen turns 38 later this month, but the 2007 Formula One champion has been showing admirable form recently. "It's a bit more painful when you get that close," the softly spoken Finnish driver said. "Tomorrow is a long race and it will be tough for tires. I have a good feeling. It's a tight first three corners so a lot usually happens."
Verstappen celebrated his 20th birthday with a fine drive. He must make Raikkonen feel old, considering that Raikkonen raced against Verstappen's father — Jos Verstappen — when making his F1 debut back in 2001.
"I'm happy to be in third, I was struggling a lot with balance in P3," Verstappen Jr. said. "I want to have a good Sunday, finally. On Saturday it's been going really well, but I haven't scored a lot of points."
Verstappen secured third place in China — the second race of the season — but has not been on the podium since and has failed to finish seven races, mainly because of engine problems. Ferrari had swapped Vettel's engine after third practice. Engineers changed the internal combustion engine as a precautionary measure after detecting an electronic malfunction on his car.
It made little difference. Vettel was on his first lap when his engine cut out. "When I went out everything was looking fine and suddenly in Turn 5 I lost power," Vettel said. "Why that all happened, right now we don't know."
The mishap was even stranger, given that Ferrari had looked very strong in the third and final practice earlier Saturday with Raikkonen leading from Vettel. In Friday's second practice, Vettel was fastest ahead of Raikkonen.
Vettel did not incur any penalty for the engine change because it was the fourth one of the season — the maximum. Any more will incur grid penalties. There were comforting words from Vettel to his mechanics, and he chose to look on the bright side of a complex situation such as saving tires for race day.
"We have more tires than everybody else and we maybe can do something with strategy," Vettel said. "If the safety car comes out in a moment that suits you, it could bring you back into the game." Two weeks ago, Vettel wasted pole in Singapore, causing a first-turn crash that took out Raikkonen, Verstappen and McLaren's Fernando Alonso with him.
It handed Hamilton the championship initiative, extending his lead to 28 points. Another strong performance could see Hamilton clinch a fourth straight win, eighth of the season and 61st overall, and take a giant stride toward a fourth F1 title with five races left after this.
"We just have to maximize every opportunity we get," Hamilton said, offering some sympathy to Vettel. "I don't really know what happened to Sebastian today. It's very unfortunate for him." One small crumb of comfort for Vettel is that, despite strong qualifying, Hamilton has only won once here — in 2014.
Last year, Hamilton was cruising to victory in Sepang when his engine cut out late on and he retired. Vettel could be forgiven for hoping for a similar ending on Sunday.