Milan Badelj scored a controversial winner eight minutes from time to give Fiorentina their second straight Serie A win and consign Roma to their first defeat of the new domestic season.
Badelj beat Roma keeper Wojciech Szczesny with a low drive from outside the box but his shot went through the legs of team-mate Nikola Kalinic, who was one of three home players standing in an offside position.
The visitors had the better of the first-half chances with Edin Dzeko whistling a header wide from Alessandro Fiorenzi's lofted pass, then volleying straight at keeper Ciprian Tatarusanu.
The Bosnian also had a penalty appeal turned down after tangling with Nenad Tomovic in the box, then fired his shot over the bar after being put through by Fiorenzi.
Fiorentina rallied and ended the first period with a dominant spell in which both Josip Ilicic and Borja Valero missed good opportunities to test Szczesny in the Roma goal.
Kalinic missed a golden chance early in the second half when he sent a tame header straight at Szczesny, then Florenzi came close at the other end with a rasping drive which was tipped onto the post by Tatarusanu.
Then Badelj pounced with the only goal of the game which was allowed to stand by referee Nicola Rizzoli, presumably because he deemed none of the offside players were interfering with play.
Francesco Totti, who replaced Diego Perotti for Roma four minutes before Badelj's goal, came close to grabbing an equaliser in the dying moments but drove his shot just wide of target.