Veteran Portugal defender Pepe has returned to Porto after signing a two-and-a-half year deal, the Portuguese champions said on Tuesday.
Pepe, 35, spent three seasons at Porto from 2004-07, winning two league titles before a £27 million move to Real Madrid.
He spent the next decade at the Bernabeu, winning three La Liga crowns and lifting the Champions League trophy three times.
The rugged defender, who will be reunited at Porto with former Real Madrid team mate Iker Casillas, joined Besiktas in 2017 but rescinded his contract with the Turkish club last month.
Porto are six points clear at the top of the Portuguese top flight.