Filip Djordjevic thought he had secured a point for the home side when he cancelled out Juan Iturbe's strike, but Mapou Yanga-Mbiwa popped up with a late winnerRoma secured second place in Serie A as it beat Lazio 2-1 in Monday's derby clash.
Lazio's place in the Champions League is still not secure after the loss. With Napoli losing 3-1 at Juventus on Saturday, Lazio knew a point would be enough to clinch third place in Serie A and make a return to Europe's premier club competition after a seven-year absence.
But Lazio was undone by its biggest rival at Stadio Olimpico after a pulsating second half.
Juan Iturbe gave Roma the lead in the 73rd minute, only for Filip Djordjevic to level eight minutes later with a close-range header.
However, Roma, playing as the away side in this fixture, had the last laugh five minutes from time when defender Mapou Yanga-Mbiwa rose highest to head Miralem Pjanic's free kick into the bottom-left corner and net his first goal for the club.
The result sets up a mouthwatering final-day clash between Lazio and Napoli at the Stadio San Paolo. Napoli is three points behind Lazio and – despite an inferior goal difference – would finish third with a win courtesy of a better head-to-head record.
Miroslav Klose had the best chance of a fiery first half in the fifth minute, but the Lazio striker sent his unmarked header wide.
Victor Ibarbo fired narrowly off target from a corner in the 70th minute, yet the Roma substitute atoned for that miss by getting to the byline and pulling back for Iturbe to flick home three minutes later.
Roma's lead was brief, though, as Lazio produced a well-worked equalizer. Djordjevic nodded home after Klose had headed Felipe Anderson's far-post ball back across goal.
Yet there was to be one last sting in the tail when France international Yanga-Mbiwa leapt to turn Pjanic's whipped delivery beyond the outstretched arm of Lazio goalkeeper Federico Marchetti.