On 29 August 2018, Real Madrid announced they had signed Mariano on a five-year contract. As Real Madrid owned 35% of his playing rights, the fee was reduced to €23 million. He was issued shirt number 7, previously worn by Cristiano Ronaldo. After his second spell at Madrid started, Mariano made his debut for the club on 19 September 2018, coming on as a 73rd-minute substitute against Roma in the first fixture of the 2018–19 UEFA Champions League group stage, and scored the last goal of a 3–0 victory with a curved shot from outside the penalty area. On 1 March 2020, after just one minute of coming off the bench during his first league appearance of the season, he doubled Real Madrid's lead in a 2–0 victory against FC Barcelona in the 90th minute. He made five appearances during the league season, as Real Madrid won the 2019–20 La Liga.