Following intense transfer speculation, coupled with his contract with Manchester City due to expire in June 2019, Brahim joined Real Madrid on 6 January, for a transfer fee of £15.5 million (€17 million). His contract, which runs until 2025, also includes potential add-ons, which could see the value of the transfer to rise to £22 million (€24 million). The transfer also includes clauses which stipulates a 15 per cent sell-on fee to be received by City, which would rise to 40 per cent should Brahim depart Madrid and transfer to "another Manchester club".
He made his debut on 9 January 2019, coming on as a substitute in a 3–0 victory over CD Leganés in the Copa del Rey. His league debut came four days later, when he again came in as a substitute in a 2–1 win over Real Betis. He scored his first goal on 12 May 2019, in a 1–3 defeat at Real Sociedad.