Real Madrid kept alive their faint title hopes following their 4-2 victory over Primera Liga leaders Barcelona as they cut the gap on their rivals to six points.