Madrid: Two Spanish giants bid farewell to their boyhood clubs on Sunday as Andres Iniesta waved goodbye to Barcelona and Fernando Torres went out with a bang at Aletico Madrid.

Torres scored twice on his final appearance for Atletico, even if a Lucas Hernandez red card helped Eibar claim a 2-2 draw on the last day of the La Liga season.

Iniesta's 22-year association with Barcelona, meanwhile, ended with a victory as the player marked out as the Spaniard's successor, Philippe Coutinho, proved the difference in a 1-0 win over Real Sociedad.

With a tear in his eye, Iniesta walked off to a standing ovation from the Camp Nou in the second half, having unfastened his captain's armband and handed it to Lionel Messi.

He hugged the Argentinian and then embraced the rest of his colleagues. The 34-year-old clapped the crowd, blew them a kiss, before exhaling and ducking into the dug-out.

An extravagant post-match ceremony followed, celebrating both Iniesta and the winning of La Liga and the Copa del Rey. Barca's players returned to the pitch all wearing shirts with Iniesta's name on their backs.

"It is a difficult day," Iniesta said in a speech to the crowd. "But it has been a wonderful 22 years. It has been a privilege and a pleasure to defend and represent this club, for me the best in the world. I will keep you in my heart forever." Barca's players then huddled beneath Iniesta and tossed him into the air.

"I feel privileged," coach Ernesto Valverde said. "Just as they all do to have been a part of it. He is a unique, unrepeatable player. There is none like him."

After 22 years at the club and 16 in the first team, Iniesta's 674 appearances for Barcelona is bettered only by Xavi Hernandez, who was also on the pitch before kick-off to join in the tributes.

Real Sociedad welcomed Iniesta with a guard of honour while the crowd formed an impressive mosaic to spell out 'Infinit Iniesta' on the two sides of the stadium, with an infinity symbol, doubling up as number eights, at the ends.

A giant flag behind one of the goals read 'Gracies Per Tant', 'thank you for so much'. Torres' swansong was less emotional, perhaps because his fairytale ending had already arrived on Wednesday, when he lifted his first Atletico trophy after the Europa League final against Marseille.

But his double against Eibar added some extra sparkle in front of his own supporters, who stayed on after the final whistle to watch the team form another guard of honour as the striker left the pitch.

On his 404th appearance for Atletico, Torres' goals were his 128th and 129th for the club, coming 17 years after his first, scored against Albacete in the Segunda Division in 2001.

"I thank the whole Atletico family," Torres said afterwards.

"I knew I wanted to play here and it has been an honour and a privilege to wear this shirt more than 400 times. You have made me the happiest person in the world." Torres, like Iniesta, has yet to declare his next move but this display -- speedy, sharp and clinical -- will have caught the eye of any interested parties.

He had walked out before kick-off, with his three children, through a corridor formed by the Eibar players as Atletico's fans displayed the words, 'De Nino A Leyenda', meaning 'from a kid to a legend'.

Outside the ground, fans had posed for photos next to life-size Torres cut-outs and peered at message boards, detailing the player's greatest moments.

This, after all, was a boyhood Atletico fan, who first watched his team with his grandfather as a child, and who, when he returned to the club for a second spell in 2015, drew a crowd of more than 40,000 just for his presentation.

Atletico coach Diego Simeone predicted Torres will one day be back again.

"His return was something I'd never seen before and today's farewell was equal to that," Simeone said. "I have no doubt he will return to the Atletico, maybe we will meet again at some point. A life in football is very long."