Dani Pedrosa triumphed in a wild and chaotic Valencia MotoGP finale in which champion Jorge Lorenzo violently crashed out while leading.
The Yamaha rider had been under pressure from Pedrosa when he attempted to lap James Ellison. Slipping onto the treacherous wet line, Lorenzo lost the rear and, after a long fight to save his bike, was eventually bucked off, landing heavily on his back before sliding out into the gravel.
In his absence Pedrosa was able to cruise to victory for Honda, the pair having been more than 20 seconds clear of the field following a frantic opening in which the drama began even before the lights went out.
A drying track led to confusion and last-minute tyre calls all along the grid. While the majority opted for wets, Lorenzo gambled and ended up calling it perfectly by opting to start on slicks.
Some, including Pedrosa, realised on the warm-up lap that they needed to follow suit and consequently headed into the pits rather than returning to the grid.
As the lights went green Pedrosa was therefore missing from pole, but by starting from the pitlane he did at least limit the damage - in the region of 25s - every other rider had to face by stopping after a handful of laps to switch onto a dry set-up bike.
Lorenzo initially fell to 11th as his slicks took time to warm up, but was soon fifth and by the end of the third lap had moved into a lead he would hold until his fall.
In his absence, the lead was - for the first time in MotoGP history - claimed by a CRT rider as Aleix Espargaro stretched away in the opening stages.
The Spaniard even had the pace to respond after being demoted one spot by Andrea Dovizioso, but once on the dry he faded and within 10 tours of the track found himself being lapped.
Several more would fall victim to the treacherous conditions, including Cal Crutchlow, who fell seven laps from the end while running second.
His woe was Katsuyuki Nakasaga's gain. Replacing the injured Ben Spies at Yamaha for the weekend, the Japanese rider inherited second and held it until the flag.
It appeared he and Pedrosa would be joined by Gresini's Alvaro Bautista, but with one lap to go Casey Stoner's fightback from his mid-race stop was completed as he stole ahead and into third.
The Australian therefore bows out with a victory and a podium in his final two races in MotoGP.
Michele Pirro rode superbly to finish fifth on the CRT Gresini FTR-Honda, ahead of Tech 3's Dovizioso - who lost additional time trying to get his second bike started - Karel Abraham and Danilo Petrucci.
In his final race for Ducati, Valentino Rossi could only manage 10th.
He was lapped 14 laps from the finish, an inglorious end to his two-year spell with the Italian outfit.
Results - 30 laps: Pos Rider Team/Bike Time/Gap 1. Dani Pedrosa Honda 48m23.819s 2. Katsuyuki Nakasuga Yamaha + 37.661s 3. Casey Stoner Honda + 1m00.633s 4. Alvaro Bautista Gresini Honda + 1m02.811s 5. Michele Pirro Gresini FTR-Honda + 1m26.608s 6. Andrea Dovizioso Tech 3 Yamaha + 1m30.423s 7. Karel Abraham Cardion Ducati + 1m31.789s 8. Danilo Petrucci Ioda Suter-BMW + 1 lap 9. James Ellison Paul Bird Aprilia + 1 lap 10. Valentino Rossi Ducati + 1 lap 11. Aleix Espargaro Aspar Aprilia + 1 lap 12. Randy de Puniet Aspar Aprilia + 2 laps 13. Hiroshi Aoyama Avintia FTR-Kawasaki + 2 laps 14. Colin Edwards Forward Suter-BMW + 3 laps Retirements: Cal Crutchlow Tech 3 Yamaha 22 laps Claudio Corti Avintia Inmotec-Kawasaki 17 laps Hector Barbera Pramac Ducati 16 laps Jorge Lorenzo Yamaha 13 laps Stefan Bradl LCR Honda 9 laps Roberto Rolfo Speed Master Aprilia 6 laps Ivan Silva Avintia FTR-Kawasaki 2 laps Nicky Hayden Ducati 2 laps