Totti, playing his final game with the capital side after a storied 25-year career that garnered only one league title, was handed a final-day gift when he was called upon to replace Egyptian Mohamed Salah on 54 minutes.
Totti failed to score on what was his 619th and final Serie A appearance of 785 games in total.
Totti's last hurrah the talk of final matchday
But by the end of a valuable win that secured Roma's place in next season's Champions League, the evergreen playmaker experienced a send-off that saw almost the entire stadium shed tears.
One teary-eyed fan broke the barriers to run and hug his hero as they waved off arguably the most symbolic player in Italy over the past 20 years.
"The moment has arrived. I've cried the whole day. This was my only jersey," said Totti. "I took this decision with my wife and my family. I'd like to stay for another 25 years. Thank you Roma, thanks to my family, my Mum, Dad and brother.
Totti set to retire at season’s end, says Monchi
"I'd love to write a poem, a song, but all I can do is try to use my feet to express myself."
Totti played a pivotal role in Roma ending an 18-year wait for the scudetto in 2001, and — barring any last-minute decision to continue his playing career elsewhere — is now set to start working alongside Roma's sporting director Monchi.
He added: "Damn it. I get goosebumps when I think about June 17, 2001. From tomorrow, I'll be a grown up."
Yet for Totti, and the thousands of fans who showed up sporting special T-shirts and banners to pay tribute to 'Il Re di Roma' (The King of Rome), it was a nervy final game of the season.
Genoa travelled to the capital intent on ruining Totti's farewell party and stunned the stadium into silence when Pietro Pellegri hit their opener after just three minutes.
Roma hit back with goals from Edin Dzeko and Daniele De Rossi having them 2-1 ahead only for Darko Lazovic to level 11 minutes from time.
With Napoli romping to a comfortable 4-2 win away to Sampdoria, Roma were in trouble, on their way to a third-place finish and without an automatic place in the group stages of next season's Champions League.
But moments after Totti saw a chance thwarted by the boot of Santiago Gentiletti, Perotti fired the hosts into a 3-2 lead when he got on the end of Dzeko's knock-down to beat Eugenio Lamanna from close range on 90th minute.
Roma's 28th win of the campaign left Luciano Spalletti's men in second place, one point ahead of Napoli and four behind champions Juventus, who sealed a record sixth consecutive Serie A title last week.
De Rossi paid tribute to his close friend Totti and his status as a symbol of Rome, as well as Roma, over the years: "He won the scudetto, and he united a city that falls apart at the least problem.
"But Totti is now a friend that I won't get to see every day."
Napoli finished third as Dries Mertens missed out on Serie A's 'Capocannoniere' top scorer's award.
He got the opener away to Sampdoria, with Lorenzo Insigne, Marek Hamsik and Jose Callejon also scoring.
The Belgian finished on 28 goals, one shy of Dzeko's tally of 29.
Meanwhile, Crotone avoided relegation in remarkable fashion thanks to a 3-1 win at home to Lazio.
Andrea Nalini scored twice either side of a Diego Falcinelli goal for Crotone against a Lazio side who had Bastos sent off in the first half.
That allowed the small side from the heel of the Italian peninsula to leapfrog Empoli, who are relegated after a 2-1 defeat away to Palermo.
Crotone seemed doomed at the start of April, but took 20 points from their last nine games to stay up.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ