Leo Messi had put Barcelona ahead in the first half before he went off injured.
Zlatan Ibrahimovic struck a controversial equaliser against his former club, before Xavi netted a penalty to put Barcelona ahead again. Blaise Matuidi’s deflected effort drew the home team level in the last minute.