Barcelona failed to close the gap on La Liga leaders Real Madrid as they were beaten 2-0 at Malaga, where Brazil forward Neymar was sent off.
Antoine Griezmann had netted a late equaliser as Atletico Madrid secured a 1-1 draw away at their city rivals earlier in the day, which could have allowed Barcelona to leapfrog them at the top of the table.
However, Malaga boss Jose Miguel Gonzalez had not read the script as his side chalked up a second successive victory to move closer to safety.
Sandro netted on the break against his former club after half an hour and substitute Rodriguez Jony added a late second after Neymar had seen red having picked up a needless second caution.
As a result, Real Madrid edge three points clear of Barcelona with a match in hand, while Malaga now sit 14th.
Barcelona had made four changes with Andre Gomes and Jordi Alba among those drafted in. Gerard Pique and Ivan Rakitic were suspended while Andres Iniesta was on the bench.
Malaga were content to sit deep and allow the visitors plenty of possession.
Barcelona opened the home side up after 16 minutes as Alba sent Luis Suarez racing clear into the penalty area but Carlos Kameni was out quickly to make a goal-saving block.
The Malaga goalkeeper was alert again to smother a cross from the Uruguayan as Neymar looked to pounce, before Lionel Messi curled a free kick over.
At the other end, Barca keeper Marc-Andre ter Stegen failed to deal with a back-pass and the ball dropped to Jose Recio but the midfielder failed to hit the target with his long-range shot at an empty net.
Malaga then swept into the lead in the 32nd minute as La Rosaleda erupted. Defender Juan Carlos knocked a long ball forwards, which sent Sandro clear as he ran from his own half to spring a high Barcelona offside trap with Jeremy Mathieu playing him on.
The striker, who started his career at the Camp Nou, held his nerve as he sprinted into the penalty area before slamming the ball past Ter Stegen at the near post.
Barcelona manager Luis Enrique had seen enough and made changes for the start of the second half as Iniesta and Sergi Roberto were sent on to replace Mathieu and Denis Suarez.
It was Malaga, though, who should have further extended their lead as the hour mark approached. The hosts broke down the left through Sandro, who cut the ball back across the face of goal to Anor Juanpi, who could only tap a tame finish straight into the arms of Ter Stegen.
Barcelona went close to an equaliser when Neymar turned to drill the ball against the outside of a post from a tight angle.
The Brazilian sent a header over from Suarez's cross and then had a rush of blood as he collected a needless second caution for barging into Diego Llorente to leave Barcelona down to 10 men for the final 25 minutes.
Malaga thought they had made their extra man count when substitute Adalberto Penaranda knocked the ball in with a neat finish, but the on-loan Watford forward's celebrations were soon curtailed by an offside flag which looked a marginal call.
Juan Carlos was tripped by Javier Mascherano, with contact appearing to have taken place right on the 18-yard line, but Sandro fired the free kick into the wall.
At the other end, Sergi Roberto looked to have been caught by Luis Hernandez again just inside the box, but the referee again opted for a free kick just outside which Messi failed to get around the defenders.
With the clock ticking down, Barcelona continued to pour forward but were caught on the counter.
Substitute Dias Charles sent Pablo Fornals away down the right and he held the ball up before cutting it back to Jony to slam into the net.