On 19 August 2017, Hakimi was promoted to the main squad as a backup to Dani Carvajal and Nacho, and was assigned the number 19 jersey. He made his first team – and La Liga – debut on 1 October, starting in a 2–0 home win over Espanyol. He scored his first La Liga goal on 9 December 2017 in a 5–0 win against Sevilla. On 12 May 2018, he scored his second goal against Celta Vigo in a 6–0 win. In the 2017–18 UEFA Champions League, he made two appearances as Madrid won the title, their third consecutive and 13th overall. Although not in the squad for the final of the competition, he received a medal and is credited as the first Moroccan player to win the Champions League.