World champion Casey Stoner has ended his successful season on a high, winning a thrilling Valencia MotoGP on Sunday.
The Australian pipped Yamaha's Ben Spies by 0.015 seconds in the final round of the championship, which saw tributes paid to fallen rider Marco Simoncelli.
Repsol Honda's Andrea Dovizioso, a team-mate of Stoner, was third, ahead of Monster Yamaha's Cal Crutchlow.
Stoner, who wrapped up the title in Australia on October 16, led for most of the race and looked headed for a convincing win.
But as rain began to fall in the last few laps, Spies began his charge to chase down Stoner.
The American took the lead on the final lap, but Stoner got a better run on the last corner and edged him on the line.
Dovizioso's finish saw him claim third in the championship, behind Jorge Lorenzo, who missed the last round because of injury.
Several riders crashed out of the race on the first corner after Rizla Suzuki's Alvaro Bautista came together with Dovizioso.
Bautista's fall saw him take Pramac Racing's Randy de Puniet and Ducati duo Valentino Rossi and Nicky Hayden out of the race with him.
Repsol Honda's Dani Pedrosa finished fifth, ahead of Lorenzo's Yamaha replacement Katsuyuki Nakasuga and the Tech 3 Yamaha of MotoGP debutant Josh Hayes.
Cardion Ducati's Karel Abraham, Pramac Racing's Loris Capirossi and LCR Honda's Tony Elias rounded out the top 10.
Riders in all three classes gathered to pay tribute to Simoncelli, who died in a crash in Malaysia on October 23, after the MotoGP warm-up.
Stoner's 10th win of the season meant he finished 90 points clear of Lorenzo in the championship.