Neymar opened the scoring in the 18th minute and then provided substitute Alexis with a pass which the Chilean subsequently lobbed over Diego Lopez to finish off the visitors with 12 minutes remaining.
Twenty-year-old Jese got a goal back for Madrid in stoppage time, but there was not enough time left for an equaliser.
Barca coach Tata Martino said afterwards: "The victory is good for our spirits, and is more important in that sense than mathematically.
"There is still 60 per cent of the league season left, and Madrid and Atletico are close to us, they can still make up the difference."
For breaking stories and all the great banter like us on Facebook: facebook.com/tribalfootball