Christian Brocchi's goal for Milan 11 minutes after the break cancelled out Totti's opener early in the first-half before the Roma skipper sealed the victory seven minutes from time.
The win placed Roma in third place of the Serie A table with 23 points, just one adrift of leaders Inter Milan, who face Parma on Sunday.
On the other hand, Milan's misery continued after the third successive defeat in the league put them in 16th spot with seven points, having started with minus eight as a sanction for their part in the match-fixing scandal.
Totti stunned the home crowd as early as the seventh minute as a result for Alessandro Nesta's error.
The former Lazio defender cleared the ball poorly into the path of Brazilian midfielder Rodrigo Taddei, who chipped the ball to Totti and the Italian international received it with a spectacular volley past Milan keeper Dida.
Brocchi leveled the score in the 56th minute after he unleashed a powerful drive into the back of the net.
Totti restored the lead seven minutes from time when ghosted behind Paolo Maldini and connected with Mancini's cross to head the ball home.