Marc Marquez reeled in and overtook brother Alex to increase his MotoGP championship lead with a win in the Aragon Grand Prix sprint, while Bagnaia had another awful race.
A subpar start from pole made Marquez's life difficult in the early going, the six-time champion relegated to fourth - and making body-to-body contact with Pedro Acosta on the fast-starting KTM in the process.
Leading finishers
1 M Marquez
2 A Marquez
3 Aldeguer
Full results at bottom of page
But Marquez repassed Acosta coming out of the corner, then lunged down the inside of Franco Morbidelli for second at Turn 1 on the following lap.
There was no immediate attack for the lead - in fact, Alex Marquez built up a bit of a cushion after Marc overtook Morbidelli - but soon enough the pendulum of the race swung the other way.
Marc was finally with Alex at the end of the fifth lap and made another Turn 1 move at the start of the sixth, claiming the lead for good and immediately breaking away - ultimately finishing two seconds clear.
The soft rear tyre worked well for the Marquez brothers, but behind them it was the medium runners making waves - and for rookie Fermin Aldeguer the choice of the medium paid off with a podium.
He'd made a lively start, briefly moving up to as high as fourth although quickly being re-overtaken by former Moto2 rival Acosta.
But as the race wore on Aldeguer unsurprisingly got quicker - and once Acosta ran wide trying to work his way past Morbidelli, he was left vulnerable to Aldeguer.
Aldeguer attacked Acosta at Turn 12, Acosta struck back on the back straight, but Aldeguer finally conclusively won the battle in the final two corners - before setting off after and reeling in Morbidelli.
He finally completed the move on lap nine, settling into third, with the Marquez brothers too fast and too far up the road.
Morbidelli came under more pressure in the final laps but held on to fourth over Acosta, VR46 team-mate Fabio Di Giannantonio (running the medium rear) and Tech3 KTM's Maverick Vinales.
Marco Bezzecchi went from penultimate on the grid to eighth place with the help of the medium rear, while Brad Binder recovered from an uncharacteristically dreadful start to claim the final point in ninth.
Fabio Quartararo spent much of the race in the points, but his and Yamaha's hopes of getting anything from the sprint were dashed when he was overtaken by Vinales and then slowed massively on corner exit in trying not to hit the KTM.
Fellow Yamaha rider Jack Miller was involved in the race's biggest flashpoint, colliding with Joan Mir - who crashed in the gravel trap as a result - and incurring a long-lap penalty.
It was a horrible race for Bagnaia, whose afternoon began to unravel with being picked off by Acosta and Aldeguer at the start and never got much better - as he was muscled down the order to an eventual 12th-place finish.
The only other retirement besides Mir was Augusto Fernandez, perhaps with an issue on his development-spec Yamaha.
Results
1 Marc Marquez (Ducati)
2 Alex Marquez (Gresini Ducati) +2.080s
3 Fermin Aldeguer (Gresini Ducati) +4.630s
4 Franco Morbidelli (VR46 Ducati) +5.944s
5 Pedro Acosta (KTM) +6.095s
6 Fabio Di Giannantonio (VR46 Ducati) +6.379s
7 Maverick Vinales (Tech3 KTM) +7.213s
8 Marco Bezzecchi (Aprilia) +8.343s
9 Brad Binder (KTM) +9.982s
10 Raul Fernandez (Trackhouse Aprilia) +11.427s
11 Fabio Quartararo (Yamaha) +13.331s
12 Pecco Bagnaia (Ducati) +14.017s
13 Jack Miller (Pramac Yamaha) +16.494s
14 Alex Rins (Yamaha) +17.202s
15 Miguel Oliveira (Pramac Yamaha) +18.287s
16 Johann Zarco (LCR Honda) +19.284s
17 Enea Bastianini (Tech3 KTM) +19.841s
18 Lorenzo Savadori (Aprilia) +23.763s
19 Somkiat Chantra (LCR Honda) +31.069s
DNF Augusto Fernandez (Yamaha)
DNF Joan Mir (Honda)