Jorge Lorenzo closed to within 18 points of MotoGP championship leader Marc Marquez by winning at Phillip Island while Marquez was black-flagged for missing the pit window.
But Marquez stayed out for 11 laps in his first stint, leading to his disqualification a few laps later.
His Honda team-mate Dani Pedrosa also made a pit error, exceeding the speed limit on entry and being ordered to drop a place.
He heeded the error by letting Marquez past just before the latter received the black flag.
Yamaha man Lorenzo had led from the start under huge pressure from both Hondas.
A slight mistake from the leader on lap one took Marquez wide as well and let Pedrosa slip into the lead, but only for one corner before Lorenzo muscled back through and brought Marquez with him.
Pedrosa was the first of the lead trio to pit at the end of lap nine, but he appeared not to slow in time for the revised speed limit line.
Lorenzo came out just in front after his pitstop a lap later, while Marquez inexplicably stayed out.
He finally pitted after lap 11, rejoining right alongside Lorenzo, with minor contact between them shoving Marquez wide and down to third.
After Marquez's black flag, Lorenzo pulled clear of Pedrosa to take a win that revitalised the championship battle.
Valentino Rossi claimed third in a near-photo-finish with Cal Crutchlow and Alvaro Bautista after a fraught battle that ended with all three covered by 0.169 seconds.
Bradley Smith briefly ran fourth after a superb start, before falling back to sixth.
Nicky Hayden was top Ducati in seventh, as Pramac's Andrea Iannone beat the second factory Desmosedici of Andrea Dovizioso to eighth.
Randy de Puniet topped CRT in 10th for Aspar.
Results - 19 laps: Pos Rider Team/Bike Time/Gap 1. Jorge Lorenzo Yamaha 29m07.155s 2. Dani Pedrosa Honda +6.936s 3. Valentino Rossi Yamaha +12.344s 4. Cal Crutchlow Tech 3 Yamaha +12.460s 5. Alvaro Bautista Gresini Honda +12.513s 6. Bradley Smith Tech 3 Yamaha +28.263s 7. Nicky Hayden Ducati +32.953s 8. Andrea Iannone Pramac Ducati +35.062s 9. Andrea Dovizioso Ducati +35.104s 10. Randy de Puniet Aspar Aprilia +37.426s 11. Aleix Espargaro Aspar Aprilia +46.099s 12. Colin Edwards Forward FTR-Kawasaki +48.149s 13. Yonny Hernandez Pramac Ducati +49.911s 14. Hector Barbera Avintia FTR-Kawasaki +49.998s 15. Danilo Petrucci Ioda-Suter-BMW +58.718s 16. Luca Scassa Cardion Aprilia +58.791s 17. Claudio Corti Forward FTR-Kawasaki +1m08.105s 18. Michael Laverty PBM Aprilia +1m27.230s 19. Lukas Pesek Ioda-Suter-BMW +1m31.093s 20. Hiroshi Aoyama Avintia FTR-Kawasaki +1 lap 21. Damian Cudlin PBM-Aprilia +2 laps Retirements: Marc Marquez Honda DSQ Bryan Staring Gresini FTR-Honda DSQ
Autosport has produced a standalone special magazine to celebrate our 70th birthday. All current print subscribers will receive a copy for free. To order your copy of the 196-page Autosport 70th Anniversary issue, please go to: autosport.com/autosport70th