The first chance of the game fell to Roma after just two minutes when Daniele De Rossi tried his luck from outside the Inter penalty box, but he failed to keep it on target.
Five minutes later Osvaldo took an attempt from distance but without success.
Roma finally took the lead in the 15th minute when Alessandro Florenzi headed home Totti's cross from the centre of the Inter box.
That spurred on Inter, as Wesley Sneijder and Diego Milito came close to equalising before Walter Gargano forced Maarten Stekelenburg into making a save on 35 minutes.
The Nerazzurri deservedly pulled level on the stroke of half time when Sneijder released Antonio Cassano on the left, and the Italian forward made no mistake in finding the Roma goal.
The Lupi restored their one-goal advantage midway through the second half when Totti brilliantly sent through Osvaldo to score from outside the Inter area.
It became 3-1 to Roma in the 81st minute when Marquinho squeezed a shot into the Inter net from a tight angle after Osvaldo chipped him a ball.
Roma finished the game with 10 men, though, as Osvaldo was sent off for a second bookable offence in injury time.