Edin Dzeko had opened the scoring and Roma rattled the woodwork three times, but Mauro Icardi inspired an Inter comeback to win 3-1.
It is the first time the Nerazzurri have won this fixture in Serie A since 2008.
This was an early top of the table showdown, but also the first time Luciano Spalletti had returned to the Stadio Olimpico since he left in a rather bitter rapport with the home fans. Joao Cancelo and Dalbert weren’t ready to start yet, but Borja Valero was moved into a more advanced role. The Giallorossi missed Bruno Peres, Emerson Palmieri, Rick Karsdorp and Nuri Abdullahi, while Alessandro Florenzi was on the bench for the first time in 10 months after double ACL surgery, so Juan Jesus became a makeshift right-back.
The visitors were more aggressive in the opening stages, especially down the right flank, and Mauro Icardi bundled wide from point-blank range.
Aleksandar Kolarov got the winning goal away to Atalanta last week and almost did it again here, his left-foot volley from distance smashing against the upright.
Roma were getting into a rhythm and took the lead. Radja Nainggolan’s chipped pass over the top allowed Dzeko to spring the offside trap, chest and volley with his right boot from 10 yards.
Samir Handanovic plucked a Dzeko curler out of the air, while Joao Miranda risked an own goal with his deflection on a Diego Perotti cross.
The hosts rattled the woodwork again on 39 minutes, a Nainggolan screamer bouncing off the base of the far post from the edge of the box.
Icardi’s ferocious shot stung Alisson Becker’s gloves at the near stick after good work from Antonio Candreva and Borja Valero.
Spalletti made a change at half-time, introducing Joao Mario for Roberto Gagliardini and pulling Borja Valero back into his usual deeper role.
There was controversy on 55 minutes when Milan Skriniar appeared to trip Diego Perotti at the by-line, but VAR was not examined and a corner given.
Roma rattled the frame of the goal for the third time on 65 minutes, as a Perotti missile bounced off the inside of the far top corner.
However, Inter got their equaliser against the run of play, as Candreva threaded through an assist and Icardi turned on a sixpence to drill into the near bottom corner.
Moments later it was almost 2-1 for Roma, as substitute Stephan El Shaarawy’s lob had beaten Handanovic, but Dalbert got back for an acrobatic goal-line clearance.
It was wide open now, Ivan Perisic hitting a fresh-air volley and Perotti’s counter over-hit for Nainggolan, but Inter turned it around completely with a very similar goal. Again Icardi turned on the spot to fire into the near bottom corner, this time on a Perisic assist.
Icardi almost completed his hat-trick moments later, holding off Kostas Manolas to test Alisson. At the other end, Dzeko rolled across for Nainggolan, who saw the first attempt charged down by Dalbert and the second over the bar.
Roma were laying siege to the Inter goal, but were caught out on the counter for a third goal when Perisic skipped away from Juan Jesus and pulled back for Matias Vecino to tap in from four yards, sneaking up behind Manolas.
It was almost 4-1 in stoppages, but Alisson got his gloves to the Joao Mario counter-attack.