Barcelona extended their lead over Real Madrid with Atlético Madrid barely hanging on in the La Liga title race in third.