Dani Pedrosa won the season-ending Valencia Grand Prix after starting from the pit lane and taking advantage of world champion Jorge Lorenzo's crash on Sunday.
Katsuyuki Nakasuga was second on his Yamaha, more than 37 seconds behind, while retiring two-time world champion Casey Stoner earned his 69th career MotoGP podium with a third-place finish in his final race.
Pedrosa had won pole position in Saturday's qualifying, but he opted to take the pit-lane start penalty for a last-minute change of tires due to a rain shower that slicked the four-kilometre Comunitat Valenciana track.
The Spaniard made quick work of the field to steer his Honda into second place before taking over the lead when Lorenzo went off on his Yamaha after hitting a wet patch with 17 laps to go.
"It was a thrilling race," Pedrosa said.
"I had never started from pit lane before, but after the warm-up lap I had a moment of inspiration when I just knew
I needed to change tires.
"It's fantastic to win the last race of the season."
It was Pedrosa's 22nd career MotoGP victory. He finished the championship in second place behind Lorenzo, but his seven wins on the season gave him one more than his fellow Spaniard. Lorenzo ended with 350 points.
Pedrosa had 332, while Stoner was a distant third with 254.
Seven of 21 riders failed to finish the accident-filled race.
Stoner turned in a final lap to salute the fans.
"I am a little disappointed for not being able to win this race, but it's a nice way to retire getting on the podium" Stoner said.
"Thanks to all my team, my supporters and my sponsors for all these years."
The Australian rider is retiring at 27 after winning the MotoGP title with Ducati in 2007 and his current Honda team in 2011.
He won 38 MotoGP races since joining the circuit full-time in 2006.
In Moto2, Marc Marquez capped his world championship season with a win after starting from second place. Julian Simon and Nicolas Terol completed the all-Spanish podium.
Marquez finished the season with 324 points. Fellow Spaniard Pol Espargaro was second with 268 points, while Andrea Iannone of Italy was third with 193.
In the Moto3 class, British rider Danny Kent passed world champion Sandro Cortese of Germany on the last lap. Cortese finished second, with Zulfahmi Khairuddin of Malaysia in third.
Cortese finished the season with 325 points. Luis Salom was runner-up with 214, with fellow Spaniard Maverick Vinales in third place with 207.