Juanmi grabbed the only goal of the game after just seven minutes when he pounced on an error by Dani Alves.
Thereafter, the hosts failed to break down a well-organised Malaga defence, which also frustrated the Catalans in a 0-0 draw earlier in the season.
Defeat leaves Barca still a point adrift of Real Madrid at the top of the table, but the European champions can extend that advantage to four points when they travel to Elche on Sunday.
“We’re used to these kind of games. I’d like it to be an accident but it is becoming habit, the opposition close up and we can’t find a way through,” lamented Barca boss Luis Enrique.
“These kind of results are sometimes a good reminder that other sides have their qualities. You could consider this a deserved defeat.”
Defeat was all the more of a surprise as Barca came into the game in fine form having won their last 11 games in all competitions, scoring 42 goals in the process.
Their star front three of Lionel Messi, Neymar and Luis Suarez were kept remarkably quiet as Malaga became the first side since Getafe in 2007/08 to keep Barca scoreless over two games in La Liga.
“They scored and shut up shop. They let us use the ball out wide and we tried, but the final ball wasn’t there and we didn’t create clear-cut chances,” added midfielder Sergio Busquets.
The opener arrived thanks to a huge defensive error as Alves under-hit a backpass to Claudio Bravo and Juanmi nipped in to slot home.
Barca nearly replied immediately as a corner fell to Rafinha Alcantara and his fierce drive was blocked on his own goal-line by Weligton.
Messi nearly unlocked the Malaga defence with a lovely in-swinging cross that Andres Iniesta could only head into the grateful arms of Carlos Kameni.
Luis Enrique turned to Ivan Rakitic and Pedro Rodriguez from the bench in the search for a breakthrough after the break.
It was Pedro who had the best chance to level seven minutes from time when he was played in by Neymar, but the Spanish international could only fire the ball into the side-netting.
And it wasn’t to be for Barca as a dipping volley from Suarez was clutched by Kameni before the Cameroonian denied Gerard Pique in stoppage time.
– Atletico close in –
Champions Atletico Madrid are now just three points behind Barcelona after they cruised to a 3-0 win over Almeria thanks to a double from Antoine Griezmann.
Mario Mandzukic put the hosts ahead from the penalty spot after 13 minutes and the Croatian then turned provider for Griezmann to double Atletico’s advantage seven minutes later.
The two combined once more just before the half-hour mark as Mandzukic headed down for Griezmann to slam home his 17th goal of the season.
Coach Diego Simeone then removed both his front men early in the second half to keep them fresh ahead of Atletico’s return to Champions Leagueaction away to Bayer Leverkusen on Wednesday.
Meanwhile, Valencia tightened their grip on fourth place as Pablo Piatti struck the winner nine minutes from time in a 2-1 victory away at Cordoba.
Andre Gomes opened the scoring for the visitors before the break, but Los Che looked set to drop two points when Nabil Ghilas levelled from the spot before they got lucky when Piatti’s mishit shot from Alvaro Negredo’s knockdown looped into the far corner. – Agence France-Presse