World champion Casey Stoner claimed he took more risks in the last half a lap of the Valencia MotoGP season finale than he had all season.
The Repsol Honda rider's reward was to snatch a tenth victory of the year by just 0.015sec over Yamaha's Ben Spies, whom Stoner passed on the dash to the chequered flag.
Stoner had enjoyed a ten-second lead earlier in the race, but backed off when the rain spots got heavier, then lost the lead to Spies after a small mistake with three laps to go.
"My heart was in my throat!" admitted Stoner. "Being the first one to arrive to the conditions on the track, I wasn't sure how hard to push so I slowed up to ensure I finished the race and I thought if they come past I can stay with them.
"Then coming onto the back straight I made a slight mistake when I went into neutral instead of first gear and Ben came past me. I tried to stay with him but he was riding very well, fast and smooth and he looked confident in the conditions, more so than me.
"Then in the last half of the last lap I thought 'this is it' and just decided to go for it - take some risks that I haven't taken all season. I was able to catch Ben going into the last turn, then got fantastic drive on the way out. I managed just to pip him on the line. Sorry Ben!"
With nearest rival Jorge Lorenzo sidelined by injury for the last three races, Stoner - the first and then last 800cc world champion - finished the season with a 90-point advantage over the Yamaha rider.
MotoGP riders will be back at Valencia on Tuesday for the start of a 1000cc test.