Madrid came into the match in the spotlight having picked up just one point from their away games at Levante and Racing Santander and the title hopefuls could hardly have had a worse start as poor defending saw them trailing after just 14 seconds, Miguel Perez Cuesta the scorer.
Madrid seemingly put that dismal beginning behind them with three goals in 13 minutes either side of half-time through Ronaldo (two) and Gonzalo Higuain, but the hosts soon found themselves with more problems.
Rayo pulled a goal back in the 55th minute and then two minutes later Madrid lost Angel Di Maria to a second yellow card.
That left Madrid facing a potentially crucial final half-hour with a man less, knowing more dropped points - especially at home - could be decisive come the end of the season.
However, it was Mourinho's men who seemed to adapt better to the dismissal as they netted three more times to take the win, Raphael Varane, Karim Benzema and Ronaldo - with his second penalty of the match to complete his hat-trick - the goalscorers.