An early Juanmi strike saw Barcelona's 11-match winning streak ended as Malaga celebrated a surprise 1-0 La Liga victory.
After a frantic opening five minutes, Juanmi opened the scoring as Dani Alves failed to deal with a long ball, allowing the Malaga striker to round Barcelona goalkeeper Claudio Bravo and roll the ball into the net.
Barcelona came close to levelling the scores in the 23rd minute. Andres Iniesta's cross was directed towards Lionel Messi, but defender Miguel Torres was able to clear.
Malaga had the chance to double their lead 10 minutes later when Ricardo Horta forced Bravo into a save before Sergi Darder shot wide from the corner.
Three minutes later, Horta headed the ball into Bravo's hands as Malaga continued to more than hold their own.
Barcelona began the second half in the ascendancy, but it was Malaga who had the first good chance as Horta broke free of Jordi Alba, but shot well wide of the target.
Neymar felt that he should have had a penalty a minute later, but he was flagged offside before the collision took place.
Barcelona struggled to create good chances, but Iniesta headed the ball narrowly wide of the post from Messi's cross in the 58th minute.
It was not until the 86th minute that Barcelona created another clear-cut opportunity, but Pedro's shot hit the side-netting after a neat passing move.
Malaga were able to hold onto the victory in the closing stages to inflict a surprise defeat on which leaves Barcelona second in La Liga, while Malaga move up to seventh.