The Norwegian nodded in a David Pizarro cross in stoppage time after a Francesco Totti penalty had cancelled out Alessandro Del Piero's fine opener for Juve in the 51st minute.
The Turin side were down to 10 men when Roma scored the winner after keeper Gianluigi Buffon was sent off in the 83rd minute for charging out of his area and fouling Riise.
The win allowed Roma to tighten their grip on third place with 38 points from 21 games, eight points behind leaders Internazionale, who face second-placed AC Milan in Sunday's high stakes derby.
Serie A
Moratti: Mourinho won't come back to Inter
27/03/2013 AT 20:12
Juve are five points further back in fifth after their sixth defeat in eight league games deepened the troubles of Ciro Ferrara, who replaced Ranieri in the Juve dugout just before the end of last season.
"The victory was important because Juventus want to stay in the race for Champions League qualification and us winning puts them several points behind us. I'm not looking for revenge," Ranieri said.
The hosts had shown signs of recovering from the recent woes, with Mohamed Sissoko's return from duty with Mali at the African Nations Cup strengthening their midfield.
They had better of the first half, when Amauri, Nicola Legrottaglie and Del Piero failed to nod home inviting balls into the area.
Del Piero put them in front with a left-footed diagonal volley after the ball ballooned off a defender for his first league goal of an injury hampered campaign.
Totti, who replaced a limping Luca Toni in the fourth minute to make his first appearance following a month-long injury layoff, levelled after Fabio Grosso blocked Rodrigo Taddei in the area before Riise landed the killer blow.
"It's a difficult period, there's no use hiding it," Ferrara said. "Sometimes our defeats have been deserved, others not, but at this point we are a long way behind.
"I think the squad has the strength, character and personality to come out of this all together. In moments like these you have to be strong men and they are."
A section of Turin's Stadio Olimpico was closed during the match because of racist chanting by Juventus's ultra fans in an Italian Cup tie last week.
Earlier, strugglers Catania thumped Parma 3-0 at home to move up a place in the standings to third-from-bottom.
Giuseppe Mascara headed the Sicilians in front on 15 minutes shortly before missing a penalty and Jorge Martinez and Takayuki Morimoto sealed victory with second-half goals.
Serie A
Napoli stay second with win over Atalanta
17/03/2013 AT 16:14
Serie A
Balotelli hits brace as Milan beat Palermo
17/03/2013 AT 13:33