Valentino Rossi thrilled his home fans by snatching pole position for Sunday's Italian MotoGP in the final seconds of qualifying at Mugello.
Rossi is chasing a fourth win in five races this season
The world champion set the fastest-ever lap at the circuit in one minute 49.223 seconds to knock Sete Gibernau off top spot with his final effort.
Max Biaggi was third, ahead of Repsol Honda team-mate Nicky Hayden.
John Hopkins was fifth for Team Suzuki, with Marlboro Ducati rider Loris Capirossi sixth after a late mistake.
Rossi, who is seeking a fourth straight victory at his home circuit, has won three of the four races so far this season.
The Gauloises Yamaha rider holds a 37-point lead over Marco Melandri, who qualified seventh, in the title race, with Melandri's Telefonica Movistar Honda team-mate Gibernau a further five points back.
Championship leader Mika Kallio was fastest in 125cc qualifying ahead of KTM team-mate Gabor Talmacsi and Aprilia's Hector Faubel.
Mugello qualifying results:
1 Valentino Rossi (It) Yamaha 1:49.223
2 Sete Gibernau (Sp) Honda 1:49.361
3 Max Biaggi (It) Honda 1:49.458
4 Nicky Hayden (US) Honda 1:49.546
5 John Hopkins (US) Suzuki 1:49.556
6 Loris Capirossi (It) Ducati 1:49.633
7 Marco Melandri (It) Honda 1:49.805
8 Carlos Checa (Sp) Ducati 1:49.811
9 Shinya Nakano (Jpn) Kawasaki 1:49.856
10 Makoto Tamada (Jpn) Honda 1:49.951
11 Kenny Roberts (US) Suzuki 1:50.052
12 Colin Edwards (US) Yamaha 1;50.176
13 Alex Barros (Brz) Honda 1:50.281
14 Alex Hofmann (Ger) Kawasaki 1:51.056
15 Ruben Xaus (Sp) Yamaha 1:51.585