Porto have exercised their option to purchase Oliver Torres permanently from Atletico Madrid at the end of the season.
Already on loan at the Estadio do Dragao, Torres will arrive from Madrid for EUR20million ahead of the 2017-18 Primeira Liga campaign.
The 22-year-old Spanish midfielder has flourished in Portugal, scoring two goals in 18 league appearances for Porto this season.
"Porto hereby informs the market that it has exercised the purchase option for the acquisition of the sporting rights of the athlete Oliver, for the amount of EUR20m, from Atletico Madrid," Porto said in a statement on Thursday.
"It is further informed that the contract of employment with the player will be effective upon the termination of the loan agreement currently in force."
Torres emerged from Atletico's youth system in 2012 and made 36 LaLiga appearances for his boyhood club.