Valtteri Bottas claimed pole position for Saturday's sprint race in Italy after beating Lewis Hamilton by just 0.096 seconds.
After topping practice, Q1, Q2 and setting the fastest lap in the first running of Q3 in Monza, Hamilton appeared on course to take pole, only for Bottas to steal the glory with his final lap.
Hamilton's championship rival Max Verstappen finished third in his Red Bull, four tenths back, with Lando Norris fourth for McLaren.
Formula One will stage its second sprint race on Saturday, with qualifying brought forward to Friday evening.
The winner of Saturday's 18-lap dash takes three points with the runner-up two, and the third-placed driver securing a single point.
The result also determines the grid for Sunday's Italian Grand Prix. The format is due to be trialled again in Brazil in November, with F1 chiefs keen to stage as many as eight sprint races in 2022.
The fastest track on the calendar suits the grunt of the Mercedes engine and Bottas – who is set to start Sunday's race from the back of the grid after taking on a fourth engine of the year, one more than is permitted in the rules – delivered with his last attempt.
"Valtteri did a mega lap," said Hamilton, who heads into the 14th round of the campaign just three points adrift of Verstappen.
"It was looking good for me up until then but he went quicker and I couldn't match it.
"Championships have been lost by one point. There have been a lot of points lost on both sides this season, and these sprint races will help so we need to capitalise on that."
Bottas, who has been dropped by Mercedes for next season, said: "That qualifying lap was nice.
"I managed to save it until the end so it was good fun and I enjoyed it. I am relaxed now everything has been sorted for the future."
Behind Norris, Daniel Ricciardo took fifth for McLaren ahead of the AlphaTauri of Pierre Gasly, last year's surprise winner.
George Russell, whose move to Mercedes in place of Bottas was confirmed earlier this week, retained his perfect qualifying record against his Williams team-mates.
The Englishman, 23, was temporarily knocked out of Q1 only to be given a late reprieve when Yuki Tsunoda's lap was deleted for exceeding track limits at the Parabolica.
Tsunoda was demoted to 17th, with Russell taking advantage to progress to Q2. He qualified 15th, one place ahead of Nicholas Latifi in the other Williams.