Francesco Totti was in tears after a presentation to mark the final appearance of his 25-year Roma career.
The 40-year-old forward, who has scored 307 goals in 786 games for his only club, came on in the 54th minute in the win over Genoa to a standing ovation.
Roma won the game 3-2, with Diego Perotti’s last-minute winner securing a Champions League group stage spot.
After the game, Totti read a letter to the fans, including: “I’m afraid. I can’t see what the future looks like.”
He also said: “Imagine you’re a child having a good dream… and your mother wakes you up to go to school.
“You want to keep dreaming… you try to slip back into the dream but you never can.
“This time, it’s not a dream, but reality. And I can no longer slip back in.”
Captain Totti was also presented with a framed number 10, his famous shirt number, and had his wife and children on the pitch with him.
He is expected to become a Roma director but a statement during the week has led to reports he could play on elsewhere.
The game did not start well for Roma. Pietro Pellegri, 16, became the first player born in 2001 to score a Serie A goal when he put Genoa 1-0 ahead.
Roma, who would have dropped into the Champions League play-offs had they failed to win, cancelled out that opener with a goal from Edin Dzeko.
With 16 minutes remaining, the former Manchester City striker pulled the ball back for Daniele de Rossi, also a one-club Roma legend, to put them ahead. Totti was standing right behind him ready to shoot.
Darko Lazovic equalised with a header but Perotti fired home in the final minute from Dzeko’s header to ensure Roma finished runners up to Juventus and one point above Napoli – who beat Sampdoria 4-2.
All the build-up to the game was dominated by talk of ‘Totti Day’ as it was known in Italy, although coach Luciano Spalletti, who has frequently kept the star on the bench this season, said the result was more important and did not start him.
He was awarded a special jersey by Genoa before the game, with Totti banners visible in the Stadio Olimpico crowd. The atmosphere rose when he replaced Mohamed Salah nine minutes into the second half.
Totti set up a chance for Stephan el Shaarawy with a great pass but rarely looked like adding to his own tally.
Earlier this season, Roma director of football Monchi had said Totti would retire at the end of the season and become a director.
Totti’s statement on Thursday said it would be “the last time I can wear Roma’s jersey”. It added: “From Monday I’m ready to go again. I’m ready for a new challenge.”
Spalletti, who is now expected to leave the club, has regularly brought Totti on as a late substitute this season and has frequently complained about the amount of questions over the forward’s playing time.
Sunday’s game was the first time Totti played more than 30 minutes in a Serie A game since September.