Lewis Hamilton took pole position ahead of Sergio Perez in a thrilling Emilia Romagna Grand Prix qualifying session.
Briton Hamilton was just 0.035 seconds clear in the Mercedes as Mexican Perez, in only his second race for Red Bull, beat team-mate Max Verstappen.
Charles Leclerc put the Ferrari fourth, while Valtteri Bottas was only eighth in the second Mercedes.
McLaren’s Lando Norris had his fastest lap time deleted for exceeding track limits and fell from second to seventh.
It was a bitter blow for the Englishman, who had looked fast all session and appeared to have a chance of qualifying among the Mercedes and Red Bulls.
He was no more than a foot outside the track at the fast Piratella left-hander, where countless drivers have had lap times deleted through the weekend.
And while Hamilton being on pole might appear commonplace, it was a clear surprise to the Mercedes team judging by the exchange he had with race engineer Peter Bonnington on team radio afterwards, as both expressed incredulity at beating the Red Bulls.
“I definitely didn’t expect us to be ahead of two Red Bulls,” Hamilton said. “They have been so quick this weekend. They had 0.6secs on us at some times. But the car was already feeling a lot better from this weekend.
“Mad respect for the hard work from the team to narrow down the window.”
A big turnaround from Bahrain
Hamilton’s pole marked a significant shift in fortunes at the front since the first race of the season, when the Red Bull was clearly the quickest car and Verstappen was on pole by 0.4secs.
Mercedes have looked much more at home around the sweeps of Imola and technical director James Allison had already said on Friday that the car was “in a much happier place”.
But the relative pace of the two Mercedes drivers will raise questions as to whether this pole was predominantly down to an exceptional performance from Hamilton, who took his 99th career pole.
Team-mate Bottas was 0.487secs slower than the seven-time champion and faces a long and difficult race on Sunday from eighth place.
Perez produced an outstanding performance to sneak ahead of Verstappen by just 0.052secs so early in his Red Bull career, and the top three sets up an intriguing race, with the two Red Bull drivers on opposing tyre strategies.
The team made a conscious decision to split their cars, Perez making it through second qualifying on the soft tyre and Verstappen using the medium like the two Mercedes.
Perez said: “I didn’t expect to be here but I should have been on pole – I did a mistake on my final corner, but tomorrow is what matters.
“Anything can happen, we are on a different strategy to Lewis and Max. It is going to be interesting, see what we can do. Most important, get the points, get the learning, which is the priority at the moment.”
Verstappen – just 0.087secs off pole himself – blamed a mistake in the Tamburello chicane for not being higher up.
“Not so good in Q3,” he said. “I went off in Turn Three, a bit messy, just not a good lap. Can’t be good every time. We’ll see what went wrong but still P3 is a good starting position.
“It’s going to be interesting, we have the two cars and different tyres so let’s see how that will workout. We will try to make it difficult for them.”
A missed opportunity for Norris
Norris was the stand-out star of qualifying until his costly error on his final lap.
He was third fastest in the first session and improved one place in the second, and was a genuine contender for the front row.
But he ran just a smidge wide in Piratella and had the lap time that put him second ruled out for track limits and he starts a disappointed seventh, just behind team-mate Daniel Ricciardo, who had lagged well off his pace all weekend.
Leclerc was again outstanding in the Ferrari, 0.5secs quicker than team-mate Carlos Sainz in second qualifying as the Spaniard was knocked out in that session and just 0.331secs off Hamilton’s pole on his final run.
Alpha Tauri’s Pierre Gasly repeated his excellent qualifying position of Bahrain in fifth place, while behind the McLarens and Bottas, Esteban Ocon’s Alpine and Lance Stroll’s Aston Martin completed the top 10.
Their illustrious team-mates lagged behind, Sebastian Vettel 13th in the Aston Martin and Fernando Alonso only 15th in the Alpine.
Alonso was beaten by both Williams cars, with George Russell taking an impressive 12th place and Nicholas Latifi, who had the edge on Russell until qualifying, in 14th.