Lorenzo Pellegrini and Alexis Saelemaekers netted in eight first-half minutes which gave Roma the points in a fraught atmosphere at the Stadio Olimpico in Rome.
Ranieri’s team are up to 10th on 23 points, still 12 points behind Lazio who sit in the final Champions League spot but now have some breathing space between them and the relegation zone.
Six points separate Roma from Lecce, who sit just inside the bottom three and drew 0-0 with Genoa earlier on Sunday, as Ranieri slowly gets the capital club going back in the right direction.
“It’s so great to be able to make these fans happy,” said defender Gianluca Mancini, who did his post-match interview in a long coat after giving his shorts and shirt to jubilant supporters.
“Derbies are always a match apart, but we’re still only talking about three points, it’s not like we’ve won the league or anything.”
Roma were in such disarray when Ranieri became their third coach of the season in November that relegation was not beyond the realms of possibility.
But after an encouraging draw at AC Milan last weekend, Sunday’s display was another sign that a talented squad is starting to express itself, as well as being the 73-year-old’s fifth win against Lazio in as many matches.
Roma did not have it all their own way however and were camped in their own half after the break as Lazio pushed hard to get back into the match.
Pellegrini redemption
Valentin Castellanos and the impressive Nuno Tavares both went close to pulling a goal back while Loum Tchaouna’s scuffed finish looped onto the crossbar just before the hour mark.