After six successive wins this season and a record-equalling run of five consecutive one-twos, Red Bull driver Ricciardo brought down the curtain on Mercedes' dominance.
Nico Rosberg still managed to nurse his car home into second place after losing power from the energy recovery system (ERS).
The 18 points for Rosberg, though, are crucial as title rival and team-mate Lewis Hamilton was forced to retire with brake issues after 47 of the 70 laps.
It was the Briton's second retirement this season, after the opening race in Australia, and he now trails Rosberg by 22 points.
Rosberg said: "I lost ERS which means you can't harvest [energy] any more, which then affects the rear brakes. That made things very difficult. I had to cool the brakes a lot, I lost power on the straights, yet had to continue to push."
It was a race that ended in dramatic fashion, with Ricciardo making his decisive move on Rosberg on lap 68.
Come the final lap, with Williams' Felipe Massa dicing with Sergio Perez in his Force India for fourth, the Brazilian ran into the back of the Mexican. While Perez rammed into one barrier to his right, Massa flew head-on into a tyre wall at turn one, almost collecting third-placed Sebastian Vettel on his way.
Neither man was injured, however, and as the medical car rolled up to attend to them, Ricciardo went on to take the chequered flag by 4.2sec from Rosberg.
The German and Hamilton had again been vying for the lead until the midway point, when they encountered the power issues.
Hamilton succumbed first, and it appeared only a matter of time before Rosberg would too, but somehow the 28-year-old kept out of trouble.
Although the field closed behind him, at one stage and for many laps led by Perez, it was Ricciardo who made the moves.
After being stuck behind Perez for some time, the Australian finally squeezed by, releasing him to reel in Rosberg and make the winning pass two laps from home.
Ricciardo said: "I'm still a bit in shock. This is ridiculous. I'm very proud. It's been a long time since I won a race."
Behind the leading trio, Jenson Button managed to claim fourth in his McLaren, with Force India's Nico Hulkenberg fifth and Fernando Alonso for Ferrari sixth.
It was a race that also had drama at the start, not least coming out of turn one after Hamilton had edged his nose in front of Rosberg.
But with Rosberg holding the line into the corner, Hamilton had to take evasive action to avoid contact, and in doing so he immediately lost a place to Vettel.
Further down the field, though, was where the real carnage unfolded, with Marussia's Max Chilton losing control of his car through the turn three/four chicane.
Unfortunately for Chilton the car nearest to him was team-mate Jules Bianchi, with the Frenchman hit from the side and sent spinning into a wall where the rear of the Marussia disintegrated.
As for Chilton, his momentum carried him into a wall on the opposite side of the track, forcing him into retirement for the first time in his 26-race career.
For Marussia, it was arguably the most disastrous moment of their 84 races in F1, just a fortnight after their high in Monaco of scoring points for the first time, while in the battle for the title Hamilton has again been forced into playing catch-up.