Hernanes had given Lazio the lead with a first-half thunderbolt before the Roma captain netted the equalizer from the penalty spot as the visitors go into fifth in Serie A.
Hernanes had handed the intiative to the vistors in the first half before Francesco Totti levelled on the 55th minute from the penalty spot as Lazio leapfrogged Inter into fifth as Roma stayed in seventh.
Roma began the stronger of the two sides as Erik Lamela tested Federico Marchetti in the first minute with a close-range header having been picked out at the back post by Totti, only for the Lazio goalkeeper to comfortably hold.
The hosts failed to capitalize on their early pressure, though, and allowed Lazio back into the encounter, with Antonio Candreva being picked out in space on the right before smashing an effort towards Maarten Stekelenburg, which the Dutchman palmed away for a corner.
The Biancocelesti made their dominance count on the 15-minute mark as Senad Lulic countered from a Roma corner. He picked out the unmarked Hernanes in space in the middle of the park, and the Brazilian cut onto his left foot before launching an unstoppable effort past Stekelenburg from 25 yards.
Hernanes then looked to turn provider as he picked out the marauding Lulic in the 18-yard box before the latter launched a low drive towards the near post, only for Stekelenburg to turn his strike out for a corner.
Roma struggled to muster any real clear cut opportunities as Vasilis Torosidis fired from distance, with Marchetti untroubled by the effort from the Greek defender, while Candreva blasted his long range free kick over the bar as the visitors continued to press for a second.
Lazio held firm against their city rivals, but Marchetti was forced again into action in the last minute of the first half, as Totti tested his compatriot from distance having been played in by Alessandro Florenzi following some good work by the Roma midfielder on the left.
Vladimir Petkovic's side had the opportunity to double the advantage just after the interval after Paulo Mazzoleni pointed to the spot following Marquinho's handball. Hernanes failed to hit the target and sent his penalty wide of the woodwork, though, giving Roma a lifeline.
Hernanes then conceded a penalty at the other end having brought down Miralem Pjanic, and Totti stepped up and nestled his spot kick into the bottom corner just out of reach of Marchetti to level the score.
Marchetti was then called into action to first deny a Totti free kick midway through the second half before the Lazio goalkeeper prevented Florenzi from the rebound as Roma pushed to take the initiative.
The visitors' evening was made that much harder with 20 minutes remaining as Giuseppe Biava was handed his marching orders by Mazzoleni following his second yellow card.
Roma looked to make its numerical advantage count and perhaps should've gone in front with 10 minutes remaining, but Erik Lamela somehow turned Totti's corner over the bar from two yards out.
The hosts pressed late on to secure the winner, with Marchetti holding Totti's free kick five minutes from time, as the scores remained level and Lazio failed to close the gap on third-placed AC Milan.