Fernando Alonso sent the Spanish Grand Prix crowd into ecstasy as the Ferrari driver and home hero charged to his first Barcelona victory since 2006.
Kimi Raikkonen's Lotus emerged as Alonso's main rival, while Sebastian Vettel and the front-row-starting Mercedes faded in the race.
Felipe Massa moved in the opposite direction, recovering from a penalised ninth on the grid to take the final podium spot.
In a race full of tyre conservation, Alonso's approach from the outset was to charge.
While Vettel split the Mercedes into Turn 1, Alonso accelerated around the outside of both Raikkonen and Lewis Hamilton at Turn 3 to move into third.
Rosberg clung on at the front of the field through the first pitstops.
By the time they were done, Alonso was his main rival, having pitted one lap ahead of Vettel and jumped the Red Bull.
Rosberg's plunge down the order began on lap 12, when Alonso passed him into Turn 1, and Vettel and Raikkonen further demoted him before the lap was complete.
Once in front, Alonso began to pull away.
Despite running longer, Vettel turned out to be on the same four-stop strategy as Alonso, but unable to match the Ferrari's sheer pace.
Raikkonen, however, could pull off a three-stop. He lost time behind Vettel in the middle of the, then raised his pace after overtaking the Red Bull on lap 33.
Lotus had a potential edge going into the closing stages, with Raikkonen a few seconds ahead of Alonso at a point when both had a single stop to go.
But on his fresher tyres, Alonso stormed up behind Raikkonen at a rate of two seconds per lap, breezed past the Lotus then vanished into the distance, swiftly building a 12-second advantage.
Raikkonen was left to keep half an eye on Massa, who had been rapid all afternoon and got a green light from Ferrari to try to catch the Lotus. Tyre wear stymied this and forced Massa to back off again, but third was still safe.
Vettel's attempts to run longer on tyres ultimately cost him so much pace that he fell behind the earlier-pitting Massa.
The world champion had to settle for fourth, followed by his team-mate Mark Webber.
Mercedes' fade ended with Rosberg pulling off a three-stop in sixth and his despondent team-mate Hamilton right out of the points in a lapped 12th, having gone into freefall following his first stop.
Paul di Resta's Force India chased Rosberg home.
McLaren ended up eighth and ninth. Jenson Button had tumbled to 17th in the opening laps, but nursed his tyres through three stops and emerged ahead of his early-charging, but four-stopping, team-mate Sergio Perez.
Daniel Ricciardo fended off Esteban Gutierrez to give Toro Rosso the final point.
It was still a breakthrough day for Gutierrez, as a long first stint meant Sauber's rookie managed to lead a Formula 1 race for the first time.
Last year's Barcelona winner Pastor Maldonado struggled home 14th, recovering from a pitlane speeding penalty to get there.
Romain Grosjean was an early retirement with skewed right rear suspension on his Lotus.
Two pitlane incidents attracted stewards' attention.
Caterham could face sanctions after Giedo van der Garde lost a wheel on his out-lap, while Nico Hulkenberg had an unsafe release penalty following a pitlane clash with Jean-Eric Vergne, prior to which both had been points contenders.
PROVISIONAL RACE RESULTS
Pos Driver Team
1. Alonso Ferrari
2. Raikkonen Lotus-Renault
3. Massa Ferrari
4. Vettel Red Bull-Renault
5. Webber Red Bull-Renault
6. Rosberg Mercedes
7. Di Resta Force India-Mercedes
8. Button McLaren-Mercedes
9. Perez McLaren-Mercedes
10. Ricciardo Toro Rosso-Ferrari
11. Gutierrez Sauber-Ferrari
12. Hamilton Mercedes
13. Sutil Force India-Mercedes
14. Maldonado Williams-Renault
15. Hulkenberg Sauber-Ferrari
16. Bottas Williams-Renault
17. Pic Caterham-Renault
18. Bianchi Marussia-Cosworth
19. Chilton Marussia-Cosworth
DNF Vergne Toro Rosso-Ferrari
DNF van der Garde Caterham-Renault
DNF Grosjean Lotus-Renault
World Championship standings, round 5:
1. Vettel 89 1. Red Bull-Renault 131
2. Raikkonen 85 2. Ferrari 117
3. Alonso 72 3. Lotus-Renault 111
4. Hamilton 50 4. Mercedes 72
5. Massa 45 5. Force India-Mercedes 32
6. Webber 42 6. McLaren-Mercedes 29
7. Di Resta 26 7. Toro Rosso-Ferrari 8
8. Grosjean 26 8. Sauber-Ferrari 5
9. Rosberg 22
10. Button 17
11. Perez 12
12. Ricciardo 7
13. Sutil 6
14. Hulkenberg 5
15. Vergne 1
All timing unofficial