Spaniard Dani Pedrosa will start from pole position in Sunday's San Marino MotoGP after qualifying fastest on Saturday.
The 26-year-old Honda rider - taking his 41st career pole spot and his 23rd in MotoGP - was 0.018 of a second quicker than 2010 champion and compatriot Jorge Lorenzo on a Yamaha while Briton Cal Crutchlow will start from third spot as he finished 0.0144 of a second slower.
Pedrosa trails Lorenzo by 13 points in the overall standings after 12 races.
Pedrosa posted the early leading time on the fourth lap but was only able to confirm his fourth pole of the campaign in the dying seconds as first Crutchlow and then Lorenzo timed faster.
However, Pedrosa, who has never won the MotoGP title but was the youngest ever 250cc world champion aged just 19 in 2004, deprived Lorenzo of pole with a final surge in the last part of the circuit.
Italian nine-time world champion Valentino Rossi equalled his best qualifying performance of the season in taking sixth in what is his final race on home soil for the Ducati team before rejoining Yamaha.
Jonathan Rea posted the ninth quickest time in what is his first race deputising for Honda's defending world champion Casey Stoner, who is recovering after intensive leg surgery and will retire at the end of the season.