Martins was one of a number of players to cancel their contracts at Sporting earlier this summer, citing just cause following an attack by supporters at the club's training base.
The 23-year-old has now put pen to paper on a five-year deal at the Wanda Metropolitano, keeping him at the club until 2023.
"I feel the club is constantly growing in a strong manner and that's necessary for the growth of the team," manager Diego Simeone told reporters.
"Gelson is a lad who's constantly improving. We saw it last year and his characteristics can help us, He'll give us competitiveness on the right wing and offensively if we play with three up front."
Martins scored 27 goals and created 30 more in 140 appearances for Sporting, while he has also won 19 caps for Portugal at international level.