Enea Bastianini overtook Francesco Bagnaia on the last lap for a dramatic Aragon Grand Prix victory on Sunday as world championship leader Fabio Quartararo crashed out in the first lap, blowing the title race wide open.
Gresini Racing's Bastianini avenged his narrow defeat at Misano earlier this month by denying Bagnaia a fifth straight win after a photo finish in Alcariz, fighting off the Ducati rider to win by 0.042 seconds.
"It's almost like a dream," Bastianini, who started third on the grid, said after his fourth victory of the season.
"I made some mistakes during the race but in the end I ended up approaching Pecco and on the last lap I had the opportunity to attack, and I managed to win."
Bagnaia cut Frenchman Quartararo's championship lead from 30 points to 10 with five races remaining, with Aleix Espargaro a further seven points behind and back in the title hunt after completing the podium for Aprilia.
Espargaro passed Red Bull KTM's Brad Binder, who had spent most of the race in third after re-overtaking Ducati's Jack Miller on the penultimate lap to take his first podium place since Mugello in May.
"On the last lap I felt that I wasn't able to overtake Enea again, because I was already taking too many risks in the previous laps. So the 20 points are important," Bagnaia said.
"Enea did an incredible job, he was very competitive throughout the weekend and I already knew that he and Fabio were the fastest. Fabio, unfortunately, crashed on the first lap, but in any case I just tried to do my best."
Reigning champion Quartararo hit the rear of Marc Marquez's Honda on the exit of turn five before the Spaniard and LCR Honda's Takaaki Nakagami made contact, bringing the race to a premature end for all three riders.
"I lost the rear in Turn 3 and Fabio made contact. When I engaged the holeshot device later in the lap, the bike locked and moved to the left because there was a piece of Fabio's bike in the rear," Marquez said.
"It was really unlucky and I want to apologise to both Taka and Fabio."
Bastianini's victory secured Ducati the constructors' championship for the third consecutive season.