Valencia - Australian world champion Casey Stoner won the last race of the season the Valencia MotoGP here on Sunday, edging Ben Spies on the line.
Stoner - winning his 10th race of the season - had led for most of the 30-lap race before Spies took the lead with three laps remaining.
However, Stoner showed his battling qualities and regained the lead on the line to deny the American his second win of the campaign in the first race since the tragic death of Marco Simoncelli in Malaysia a fortnight ago.
"We made a huge charge at the end," said Spies, who won at Assen earlier in the season.
"But once we got ahead the track was really slick and we took it more carefully so as to avoid making mistakes.
"Casey took a couple of risks towards the end and they paid off."
Italian Andrea Dovizioso took third spot and ensured he finished third in the overall standings on his farewell from the Honda team.
"I could have taken some risks towards the end of the race, but third in the championships was too important for me," said Dovizioso, who joins Yamaha next season.
"I am really pleased to have finished third in the championship and it was thanks to my strategy here that we beat Dani (Pedrosa) because without one we could not have beaten him."
Yamaha's Jorge Lorenzo of Spain, the 2010 champion who missed the race as he recovers from finger surgery after crashing in the Australian GP warm-up at Phillip Island, finished second overall.
The whole complexion of the race was turned on its head right at the start with four riders going out.
Valentino Rossi - who was wearing a special helmet in tribute to Simoncelli - his Ducati team-mate Nicky Hayden and Randy de Puniet went out after Alvaro Bautista clipped the back of Dovizioso's Honda.
Bautista then slid along the track and took the other three riders out.
"Bautista told me that Dovizioso came over on him and he couldn't do anything about it," said Hayden.
"It is a sad way to end the season as we all really wanted to race and we thought we could put up a good fight today.
"I am pretty frustrated at same time, big let down for not just me but everyone.
"It's been a tough season and it ended sourly."
Bautista for his part confirmed that Dovizioso had given him no room to manouevre.
"It was a shame that happened but I had no option, no space to adjust my position. Thankfully nobody was harmed," he said.
Dovizioso had to keep Pedrosa in his sights as they battled for the third-placed overall finish.
The Honda duo and Spies engaged in a terrific battle for the podium placings, as Stoner established a clear lead, and the trio shadowed each other throughout proceedings.
Spies, who has had a mixed season with several non-finishes, split the Honda team-mates up with seven laps to go to give Dovizioso some breathing space and then ate huge chunks out of Stoner's lead as the rain came pouring down.
Incredibly, Stoner went wide on a corner with three laps to go and that allowed Spies to ease through on the inside but the Australian refused to let the rain ruin his day and he produced the stunning finish to give himself the perfect finish to the season.
Behind the leaders veteran Italian Loris Capirossi rode a steady race in what was his final appearance on the circuit as the three-time world champion - twice in the 125cc category in 1990/91 and once the 250cc in 1998 - cantered along to finish in mid-division.
Results from season ending Valencia motorcycling Grand Prix on Sunday:
1. Casey Stoner (AUS/Honda) 48min 18.645sec, 2. Ben Spies (USA/Yamaha) at 0.015sec, 3. Andrea Dovizioso (ITA/Honda) 5.936, 4. Cal Crutchlow (GBR/Yamaha) 8.718, 5. Dani Pedrosa (ESP/Honda) 9.321, 6. Katsuyuki Nakasuga (JPN/Yamaha) 23.818, 7. Josh Hayes (USA/Yamaha) 33.181, 8. Karel Abraham (CZE/Ducati) 37.952, 9. Loris Capirossi (ITA/Ducati) 48.953, 10. Toni Elias (ESP/Honda) 52.501, 11. Hector Barbera (ESP/Ducati) 1min 06.519sec, 12. Hiroshi Aoyama (JPN/Honda) 1:08.760
DNF: Alvaro Bautista (ESP/Suzuki), Valentino Rossi (ITA/Ducati), Randy de Puniet (FRA/Ducati), Nicky Hayden (USA/Ducati).
Final overall standings (after 18 races):
1. Casey Stoner (AUS/Honda) 350pts, 2. Jorge Lorenzo (ESP/Yamaha) 260, 3. Andrea Dovizioso (ITA/Honda) 228, 4. Dani Pedrosa (ESP/Honda) 219, 5. Ben Spies (USA/Yamaha) 176, 6. Marco Simoncelli (ITA/Honda) 139, 7. Valentino Rossi (ITA/Ducati) 139, 8. Nicky Hayden (USA/Ducati) 132, 9. Colin Edwards (USA/Yamaha) 109, 10. Hiroshi Aoyama (JPN/Honda) 98
11. Hector Barbera (ESP/Ducati) 82, 12. Cal Crutchlow (GBR/Yamaha) 70, 13. Alvaro Bautista (ESP/Suzuki) 67, 14. Karel Abraham (CZE/Ducati) 64, 15. Toni Elias (ESP/Honda) 61, 16. Randy de Puniet (FRA/Ducati) 49, 17. Loris Capirossi (ITA/Ducati) 43, 18. Katsuyuki Nakasuga (JPN/Yamaha) 10, 19. Josh Hayes (USA/Yamaha) 9, 20. Kousuke Akiyoshi (JPN/Honda) 7, 21. John Hopkins (USA/Suzuki) 6, 22. Shinichi Itoh (JPN/Honda) 3
1. Michele Pirro (ITA/Moriwaki) 46min 22.205sec, 2. Mika Kallio (FIN/Suter) at 6.150sec, 3. Dominique Aegerter (SUI/Suter) 6.363, 4. Anthony West (AUS/FTR) 8.843, 5. Kenny Noyes (USA/FTR) 9.229
Final overall standings (after 17 races):
1. Stefan Bradl (GER/Kalex) 274pts, 2. Marc Marquez (ESP/Suter) 251, 3. Andrea Iannone (ITA/Suter) 177, 4. Alex De Angelis (RSM/Motobi) 174, 5. Thomas Luthi (SUI/Suter) 151, 6. Simone Corsi (ITA/FTR) 127, 7. Bradley Smith (GBR/Tech3) 121, 8. Dominique Aegerter (SUI/Suter) 94, 9. Michele Pirro (ITA/Moriwaki) 84, 10. Esteve Rabat (ESP/FTR) 79
1. Maverick Vinales (ESP/Aprilia) 41min 44.138sec, 2. Nicolas Terol (ESP/Aprilia) at 3.216sec, 3. Hector Faubel (ESP/Aprilia) 7.460, 4. Efren Vazquez (ESP/Derbi) 14.560, 5. Jonas Folger (GER/Aprilia) 18.451
DNF: Johann Zarco (FRA/Derbi)
Final overall standings (after 17 races):
1. Nicolas Terol (ESP/Aprilia) 302pts, 2. Johann Zarco (FRA/Derbi) 262, 3. Maverick Vinales (ESP/Aprilia) 248, 4. Sandro Cortese (GER/Aprilia) 225, 5. Hector Faubel (ESP/Aprilia) 177, 6. Jonas Folger (GER/Aprilia) 161, 7. Efren Vazquez (ESP/Derbi) 160, 8. Luis Salom (ESP/Aprilia) 116, 9. Sergio Gadea (ESP/Aprilia) 103, 10. Alberto Moncayo (ESP/Aprilia) 94