A late Pablo Osvaldo goal revived Roma's slim Champions League qualification hopes at the expense of a Fiorentina side who suffered a setback in their similar ambitions in a fiery affair at the Stadio Franchi.
The home side enjoyed most of the possession and had the better chances, hitting the post twice, but there was a sting in the tail for them with Osvaldo's strike almost with the last touch of the game to cut the gap between the two sides to three points.
With three games of the season remaining, both remain in the hunt for third spot which is currently occupied by AC Milan, who have a one-point advantage over the Viola with a game in hand.
With Fiorentina keen to move up to third and Roma desperate to consolidate fifth, the stakes were high in Florence and it did not take long for the game to get warmed up.
Francesco Totti tested Emiliano Viviano for the first time in the fourth minute with the Fiorentina goalkeeper fisting the ball away.
The home team slowly picked up the reins, going close 20 minutes in when Nicolas Burdisso got in a decisive block to deny Borja Valero.
Roma were always a threat on the counter-attack, though, and Osvaldo, scorer of a hat-trick in Roma's 4-0 win over Siena a week ago, had a shot saved by Viviano at the end of one of those breaks in the 27th minute.
Stevan Jovetic had the ball in the back of the net on the half-hour mark, but play had already been held up after Bogdan Lobont and Gonzalo Rodriguez clashed.
The Roma goalkeeper received lengthy treatment with his nose bleeding, although the clash clearly had not affected his vision or reflexes as he got his fingertips to a shot from Jovetic shortly before half time, touching the ball onto the post.
The Romanian goalkeeper did not appear for the second half, though, replaced by Mauro Goicoechea, who was called into action for the first time on the hour mark to deny Adem Ljajic.
David Pizarro was the next to go close for the Viola, who upped the tempo in their search for a winner.
They had a strong claim for a penalty turned down in the 76th minute when the ball struck Daniele De Rossi's arm inside the area, but the referee waved play on.
Pizarro then hit the woodwork for the second time in the last minute with Goicoechea beaten.
The ball did not want to go in at one end, but it went in at the other end with Osvaldo snatching a late winner for the Giallorossi deep into stoppage time.
He met Miralem Pjanic's corner with a determined header to take the points for Roma and allow them to reduce the arrears on Fiorentina to three points.