Barcelona took advantage of an opening that Real Madrid left at the top of LaLiga and beat Atletico Madrid to move up.