Portugal defender Pepe has returned to Porto on a deal until 2021 following his release by Besiktas, the Primeira Liga club have confirmed.
Pepe played for Porto between 2004 and 2007 before being snapped up by Real Madrid, whom he represented for a decade.
The most successful days of his career were at the Santiago Bernabeu, winning both the Champions League and La Liga three times.
He joined Besiktas in 2017 and was well-regarded by supporters, but he opted to agree to a mutual termination of his contract towards the end of last year in a bid to help the club's worsening financial woes.
Reports swiftly suggested a return to Porto was on the cards, and the deal was finally announced on Tuesday.
"Pepe is a new signing for FC Porto," the club confirmed on its official website.
"The central defender has signed a contract lasting for two and a half seasons, until June 30 2021, and returns to Porto, whom he represented between 2004 and 2007."
Pepe added: "Porto continues to be a very special club for me."
The defender, born in Brazil but a European Championship winner with Portugal in 2016, is fondly remembered by the Dragao faithful.
Pepe helped his side lift the 2004 Intercontinental Cup during his three-year spell, and also won two Primeira Liga crowns with the club.
He re-joins the club seven points clear at the top of the league table and could make his second debut in Saturday's important trip to Sporting CP.