Real Madrid is not only fighting for the title, the luck factor is also on Real Madrid side, because Atletico Madrid and Barcelona played far below the standard (without excluding Sevilla). Other teams are not without fighting for the title, due to their lack of consistency in every game, they are far behind Real Madrid. Barcelona is very active in the transfer market, after receiving an injection of funds from the sale of Licensing and Merchandising shares, they were able to buy several players to strengthen the squad in the new season. In the following season, Real Madrid will face obstacles from Barcelona and Atletico Madrid to win the La Liga title.
I wouldn't say this as luck but their strategy in managing finances and players is very good which keeps them going.
This season, Barcelona was destroyed due to their wrong playing pattern in the hands of Koeman and the crisis they experienced due to the mismanagement of the Josep Maria Bartolomeu era who was not very good at managing finances.
On the other hand for Atletico they failed in the game and their tactics were too monotonous and the storm of injuries up front at the start of the season made them slump until the end.
Rather than saying it was luck for Madrid I would rather say that they are a club with good financial preparation and treatment of the players that made them where they are today.