Veteran goalkeeper Iker Casillas said "everything was under control" after suffering a heart attack in training, he posted on Twitter on Wednesday.
The 37-year-old, who has 167 Spain caps and played more than 500 games for Real Madrid, suffered what his club, Porto called an "acute myocardial infarction" in training earlier in the day.
"Everything is under control, a big scare but all is intact. Thank you very much for the messages and affection," Casillas said.
The club's statement on Wednesday said "the training session was interrupted to provide assistance," adding that Casillas was in a Porto hospital "well, stable and his heart problem solved."
Portuguese media reported Casillas had undergone surgery and his season was over.
Porto are second in the Portuguese championship, just two points behind leaders Benfica, and face Sporting Lisbon in the Portuguese Cup final on May 25.
The news prompted an outpouring of concern from fans, clubs former team-mates and opponents.
"Courage my friend. I hope you recover quickly," former Real team-mate Cristiano Ronaldo posted on Instagram.
Spain team-mate Gerard Pique tweeted: "Courage Iker, get well soon my friend!"
Former England striker Gary Lineker tweeted: "Wishing @IkerCasillas a full and speedy recovery. One of the greats."
Tennis star Rafael Nada and Spanish Prime Minister Pedro Sanchez, both Real Madrid fans, also sent their support.
"Real Madrid and its supporters wish to see their eternal captain recover as soon as possible and send him all the support of the world," the club said.
Casillas joined Real before he turned 10 and played 16 seasons with the first team before moving to Porto in 2015.
The former Spain captain turns 38 later in May and recently extended his contract with Porto to next year with the option of an additional year.
In addition to a raft of domestic honours with Real and Porto, Casillas has won one World Cup, two European Championships and three Champions Leagues.
He said Porto had told him of they wanted to keep him until he turned 40.
Casillas joins a growing list of footballers who have suffered heart attacks.
The most recent fatal attack came just last week, when experienced Burundi international Papy Faty died after collapsing during an eSwatini (formerly Swaziland) league match.
The most high-profile recent case was former captain of Fiorentina Davide Astori, who died of a heart attack in his sleep prior to a Serie A match with Udinese in March 2018.
Casillas and his partner, Spanish journalist Sara Carbonero, have two sons: Martin (5) and Lucas (2).