Malaga’s former Barcelona striker Sandro Ramirez punished his former side, who failed to take advantage of Real Madrid’s draw with Atletico earlier in the day in La Liga.
Antoine Griezmann had scored a late equaliser as Atlético Madrid played a 1-1 draw against leader Real Madrid earlier in the day, which gave Barcelona the chance to leapfrog them at the top of the table.
Sandro sent Malaga ahead after Juankar released him on the break, surging past Jeremy Mathieu and finishing coolly in the 32nd minute.
Substitute Jony Rodríguez added a late second after Neymar had picked up a needless second yellow card.
The defeat means Barcelona remain on 69 points, three behind Real who have a game in hand