Real Madrid claimed a 2-0 victory over a spirited Rayo Vallecano to remain hot on the heels of Primera Division leaders Barcelona.