Jorge Lorenzo took a home victory in the Spanish Grand Prix at a damp Jerez - but only after Valentino Rossi had taken Casey Stoner out in a collision as they fought for second place, and Marco Simoncelli had crashed out of the lead.
Yamaha was set for a one-two until Ben Spies crashed out with just three laps to go, allowing Dani Pedrosa (Honda) to reclaim second despite struggling for speed late on.
Simoncelli and Rossi had been the stars of the opening laps, making the best of the wet conditions to make swift progress up the order.
Though Stoner had led from pole, ahead of Lorenzo, at first, Simoncelli was soon with the lead duo, and sliced past the Yamaha and the Honda in quick succession to hit the front on lap six.
Rossi's Ducati was also surging through, and by lap seven the Italian had taken third from Lorenzo. He then went down the inside of Stoner for second into the first corner, but though the Ducati nosed ahead, he then lost control and fell, sliding into Stoner and eliminating the Honda. Rossi was able to continue at the back of the field and would later visit the Honda garage to apologise to Stoner.
That gave Simoncelli a two-second lead over Lorenzo, and the Gresini Honda rider seemed to have a fine chance of taking not only his maiden MotoGP win, but the first for a satellite rider since Toni Elias' Estoril triumph for Gresini in 2006.
But the dream ended on lap 12, when Simoncelli made a mistake at the first corner and was launched into a high-side as he tried to catch his sliding bike.
Now into the lead, Lorenzo looked set to come under threat from Pedrosa. The Honda rider had lacked pace in the opening laps, tumbling right down to 10th place before mounting a fightback that took him all the way to second.
Lorenzo had things under control, though, and with Pedrosa's pace fading as expected in the closing stages while the Honda rider battles with his arm issue, the world champion was able to stretch away.
Spies then closed in on Pedrosa, who did his best to hold the Yamaha off but eventually had to relinquish second. He soon reclaimed the place though, when Spies had a low-side with only three laps to go.
Ducati's Nicky Hayden held third after the early crashes among the leaders, before his pace drifted away and he fell to fourth. He lost that spot to Colin Edwards (Tech 3 Yamaha) moments before Spies' crash turned it into a podium place - then was given third back again when Edwards parked in the gravel at the start of the final lap.
Hiroshi Aoyama gave Gresini some consolation with a strong ride to fourth, right on Hayden's tail, ahead of the recovering Rossi and Aspar Ducati's Hector Barbera.
Rookie Cal Crutchlow (Tech 3 Yamaha) had been doing an exceptional job to run fifth for much of the race, until a late fall saw him drop to eighth. Fellow newcomer Karel Abraham also fell as he battled to resist Aoyama for seventh, but with the attrition ahead the Cardion AB Ducati rider was able to get the position back in the end. Toni Elias (LCR Honda) and John Hopkins (Suzuki) completed the top 10.
Andrea Dovizioso had a trip through the gravel and a pitstop on the way to a distant 12th on the third Honda.
Randy de Puniet's strong qualifying performance for Pramac Ducati was wasted by a bad start and later an incident that forced him to retire.
Results - 27 laps: Pos Rider Team/Bike Time/Gap 1. Jorge Lorenzo Yamaha 50m49.046s 2. Dani Pedrosa Honda + 19.339s 3. Nicky Hayden Ducati + 29.085s 4. Hiroshi Aoyama Gresini Honda + 29.551s 5. Valentino Rossi Ducati + 1m02.227s 6. Hector Barbera Aspar Ducati + 1m08.440s 7. Karel Abraham Cardion Ducati + 1m14.120s 8. Cal Crutchlow Tech 3 Yamaha + 1m19.110s 9. Toni Elias LCR Honda + 1m42.906s 10. John Hopkins Suzuki + 1m48.395s 11. Loris Capirossi Pramac Ducati + 1m51.876s 12. Andrea Dovizioso Honda + 1 lap Retirements: Colin Edwards Tech 3 Yamaha 26 laps Ben Spies Yamaha 24 laps Randy De Puniet Pramac Ducati 16 laps Marco Simoncelli Gresini Honda 11 laps Casey Stoner Honda 7 laps