Enea Bastianini won the Aragon MotoGP with a last lap overtake after mayhem at the start as world champion Fabio Quartararo crashed out to put a severe dent in his hopes of retaining the title.
Bastianini shaded Francesco Bagnaia following a nerve-jangling duel over the closing laps to deny the factory Ducati rider a fifth straight win by four-tenths of a second
With Quartararo the victim of first lap drama pole-sitter Bagnaia moved to within 10 points of Yamaha's defending champion with five races remaining.
"Enea did an incredible job all weekend, he was very competitive," said Bagnaia, who will have the race winner as his teammate next season.
"Fabio (Quartararo) was unlucky. I tried to do my best, but on the last lap I didn't feel I was able to retake Enea as these 10 points are important so I did okay."
"It was a really nice race for me," said Bastianini, on a Ducati satellite bike.
"I made some mistakes but on the last lap I was in a position to attack this time to win. Amazing!"
Aprilia's Aleix Espargaro took third at the end of a breathless 15th round of the championship which saw six-time world champion Marc Marquez's hopes of a dream return after 112 days out turn into a nightmare.
It was Marquez's Honda that Quartararo clipped, sending the Frenchman slithering across the track as his Aragon curse continued at the Motorland circuit where he has never made the podium.
Seconds later Honda's Japanese rider Takaaki Nakagami also hit the deck, after contact again with Marquez, who was forced to retire with damage to his bike.
Yamaha boss Lin Jarvis reported his star man Quartararo had escaped without serious injury.
"Obviously a really bad day for Fabio," he said.
"The good news is he's okay. I've just heard from the clinic that he has nothing, no serious problem, only abrasions, but he'll be fine for the next race in Japan.
"Unfortunately in the middle of the bunch he clipped the rear of Marquez's bike. Fabio is angry, upset, but from what we can see it appears a racing incident."
Quartararo, whose miserable day ended with another fall from a scooter leaving the track, said: "I feel bad. For once we had the pace to fight for a good result here, unfortunately that wasn't possible."
Marquez was back for the first time since the Italian MotoGP after further surgery on the right arm he injured in 2020.
"It was really unlucky," Marquez told motoGP.com of his disastrous opening lap.
"On turn three I had a moment, when Fabio was really close and there was contact.
"I felt something strange in turn five, turn 7 was ok, but coming out of it the bike started to lock and go on the left side. I had a piece of, Fabio's bike attached to mine."
At a sunkissed circuit the race was preceded by an immaculately observed minute's silence in honour of Britain's longest reigning monarch, Queen Elizabeth II, who died last Thursday.
Following rendition of the Spanish and Aragon regional anthems, the umbrellas protecting riders and bikes from the heat went down and the lights went out with Bagnaia making a perfect getaway, avoiding all the chaos behind, to lead until Bastianini made his decisive last-gasp winning move.
With only 17 points now splitting the top three in the riders' standings the tense title run-in moves on to Japan next weekend.