2008 MotoGP world champion Valentino Rossi looked to have Sepang pole position in the bag as he sat on top of the timesheets long after the chequered flag had been put out - but was to be denied by a stunning final lap from Dani Pedrosa.

Torrential rain had left the track soaking wet as the MotoGP qualifying session got underway, but it soon began to dry rapidly, meaning conditions were changing for the riders on every lap.

"The conditions were incredible today and this practice was as much about strategy as it was about qualifying tyres and set-up, because you had to judge the right moment to go out with the right tyre," said Rossi.

The teams were faced with delicate tyre decisions as they tried to keep abreast of the rapidly drying track but Rossi, his Fiat Yamaha crew and Bridgestone tyre technician got it right each time and the Italian remained close to the top throughout the session - although he was ultimately left 0.409sec from Pedrosa's Repsol Honda.

"We worked very well in our garage and managed to make the right decisions every time, so I was at the top or near to it for most of the session and able to constantly make big improvements," confirmed Rossi.

"When I saw that I'd done a 2min 1.9sec I thought that I might have the pole, but Dani was even faster so congratulations to him today.

"Anyway it's good to be back on the front row because we have been off it for two races, and now we're in a good place to start our challenge tomorrow. I am really looking forward to the race because I love this track and my M1 is really flying here. However I hope the weather is ok because for sure it will be more fun in the dry!" he added.

"We came out very well from a tricky situation today," said team manager Davide Brivio. "It was a delicate job to correctly follow the conditions, which were changing so quickly, but we managed it very well and this front row is just reward for some good work from the team. This was an important front row because there are a lot of riders here looking very competitive, but also the information from this session might be useful tomorrow if we have the same conditions. Let's hope not, but anyway we will be prepared."

Rossi's Michelin-shod team-mate Jorge Lorenzo made it two Yamahas on the front row, leaving the pair in prime position for a double-podium assault tomorrow.