MotoGP great Valentino Rossi received a timely boost from one of the championship's emerging stars in qualifying for the Valencia Grand Prix.

Rossi, a nine-time world champion, is retiring after Sunday's race, which brings the curtain down on the 2021 season.

Fabio Quartararo already has the title sewn up, and the newly crowned champion will start from eighth on the grid, two ahead of 42-year-old Rossi.

Rossi was given a helping hand by Francesco Bagnaia, who is looking to cap a superb individual season that has seen him claim wins at Aragon, San Marino and Portimao.

Bagnaia finished second in qualifying, just 0.064 seconds behind Jorge Martin, who claimed the fourth pole of his rookie season with a superb ride.

The Ducati rider crashed at Turn Two, though still found the power to provide Rossi with a tow that secured his place in Q2.

"Pecco helped me, I'm very happy," Rossi explained.  "We didn't have a clear plan, I just started behind him and he saw me but he continued to push. So thanks a lot to Pecco, who helped me improve my lap time.

"This is a great feeling for me and for the team in my last race. I think that apart from the emotional moment for me it's very important to try to make a good weekend, a good result and I will start in the top 10. So it was a good Saturday."

Bagnaia added: "No, no [it wasn't planned]. But, I did see him enter on the track before me, so it's the minimum that I can do for him. He gave so much over the years to us so it's the minimum I could do."

Bagnaia gave Martin full credit for clinching pole and the Pramac Racing driver said he took a risky approach to give himself the best chance of a second win of the season.

"In qualifying as always, we risk a lot," Martin said. "It's not an easy track because the layout is strange, it's not normal and also the grip is not perfect here. So, I was risking every lap, in every corner, but finally I could finish this lap.

"I'm really happy. My performance is good. You can see all the Ducatis are strong, so tomorrow will be a great battle but I think I have the pace to fight for the podiums."

Jack Miller, Bagnaia's Ducati team-mate, will round out the front row on Sunday.