Francesco Bagnaia denied Brad Binder a Spanish GP double in Jerez as the Ducati rider seized the lead of the MotoGP World Championship.
In a drama-filled race at Round 4, Bagnaia had the edge over Sprint winner Binder, whose Red Bull KTM team-mate Jack Miller finished on the podium again in third.
The race was red-flagged following an incident at Turn 1 on the opening lap involving Fabio Quartararo, Marco Bezzecchi, and Miguel Oliveira.
Quartararo became sandwiched between Oliveira and Bezzecchi and took out RNF Aprilia's Oliveira, who was taken to the medical centre and declared unfit for the restart.
Bezzecchi stayed upright but Quartararo went down, albeit the Frenchman was soon up on his feet. The Monster Energy Yamaha rider was handed a Long Lap penalty for the incident, which he was forced to undertake twice after an incorrect first attempt.
A quick-start procedure was put in place for a 24-lap restart.
Binder got the jump from the second row to lead from Miller and Jorge Martin (Pramac Ducati), while pole man Aleix Espargaro was again slow away on the Aprilia as he lay fifth.
Bagnaia – second in the Sprint race – moved into third with a superb move around the outside of Martin at Dani Pedrosa corner, while Miller seized the lead from Binder on the brakes at the last corner.
There was more disappointment for Repsol Honda's Joan Mir, who was a faller again after also crashing out of the Sprint on Saturday.
Alex Rins, who won in Texas at the Circuit of the Americas in the previous round, retired in the pits on the LCR Honda in what has been a disappointing weekend for the Spaniard, who was 13th in the Sprint.
Binder passed Miller to take the lead again on the brakes at the last corner on the fourth lap and the Australian then went a fraction wide at Turn 6, allowing Bagnaia through into second.
The 2022 world champion made contact with Miller's KTM and was hit with a one-place penalty as a result, forcing him to concede second place to Miller on the eighth lap.
Binder gained a few more tenths at the front as Bagnaia slowed to allow Miller past, and the South African was 0.8s ahead of Miller at the end of the lap. Espargaro was holding fourth ahead of Martin, Johann Zarco (Pramac Ducati), Luca Marini (VR46 Ducati) and Red Bull KTM's Dani Pedrosa in eighth.
Bagnaia began to pressure Miller and went through into second place on the exit of the penultimate corner as he set his sights on Binder, who had a 0.7s gap.
Zarco crashed out of fifth place at Turn 5 on lap 17 and soon afterwards VR46 Ducati's Bezzecchi, who led the title standings going into the race, went down at Turn 6.
Bagnaia produced a hot lap to claw back 0.4s on Binder, who responded with his own personal best time on lap 21. However, the Ducati rider was all over the rear of Binder's KTM and with three laps to go, he made a decisive pass for the lead into the final corner.
Binder tried all he could to hold onto the rear of the Lenovo Ducati and there was only a tenth of a second between them as they flashed over the line to begin their final lap.
The factory KTM rider hauled himself to within striking distance and briefly looked set to make a move at Angel Nieto corner, but Bagnaia had it covered and held on to claim a maximum points haul by 0.221s.
Behind Binder, Miller was safe in third from Martin, with Espargaro and Marini the top six.
Bagnaia now leads the championship on 87 points from Bezzecchi (65) and Binder (62).
Wildcard Pedrosa was a solid sixth, 6.3s behind Bagnaia, while the top 10 was completed by Alex Marquez (Gresini Ducati), Takaaki Nakagami (LCR Honda) and the luckless Quartararo, who was ahead of his Yamaha team-mate Franco Morbidelli in 11th.
Aprilia's Maverick Viñales failed to finish after his chain came off on the final lap.
Honda wildcard Stefan Bradl was 14th ahead of Raul Fernandez (RNF Aprilia), with HRC World Superbike rider Iker Lecuona – deputising for the injured Marc Marquez – 16th on the Repsol Honda.