Barcelona produced a sluggish display at the Nou Camp as they prepared for their Champions League clash with Manchester City in the worst possible way.
Luis Enrique's side suffered a shock home defeat to mid-table Malaga after Juanmi scored the only goal of the game, pouncing on a terrible mistake by right-back Dani Alves after just seven minutes.
Barcelona never recovered and fell to a defeat that will put a huge dent in their title hopes. Real Madrid are now a point clear with a game in hand - Carlo Ancelotti's team play Elche Sunday night.
The Catalans passed up the opportunity to go top of the table and instead remained a point behind league leaders Real Madrid, who had the opportunity to extend their advantage to four points by winning at Elche on Sunday evening.
Barcelona must now regroup for the trip to Manchester and the last-16 European clash with City on Tuesday evening.
Malaga went into Saturday's game 21 points behind Barcelona in the table and the result was all the more surprising as the Catalans had previously won their last 11 games in a row in all competitions, scoring 42 goals in the process.
Barcelona made seven changes to the team that thrashed Levante 5-0 last weekend, recalling Alves, Luis Suarez, Gerard Pique and Jordi Alba to the starting line-up and opting to rest Ivan Rakitic and Javier Mascherano.
The hosts made a sluggish start to the game but the Nou Camp crowd was still left stunned when Juanmi gave the visitors their shock early lead.
Goalkeeper Carlos Kameni booted the ball down field from his hands after catching a Suarez header and Alves tried to play the ball back to Bravo. But his pass was short and Juanmi raced onto the loose ball to go round Barcelona goalkeeper Claudio Bravo and knock into an empty net.
Barcelona nearly produced the ideal response at the other end, with Rafinha shooting towards the far corner with Kameni stranded, but Malaga's Weligton was on the line to make the block.
Possession continued to be dominated by Barcelona but they created few clear chances. From one, midfielder Iniesta could only nod straight at Kameni, while Alba and Pique headed over the bar and Lionel Messi went close from a free-kick.
Barcelona were also careless at the back, allowing Samu Castillejo to back-heel the ball to Juanmi inside the area, but Bravo made an unorthodox save to deny the youngster a second goal.
Juanmi had to be replaced by Jaunpi early in the second half after pulling a muscle, while Barcelona boss Luis Enrique threw on Rakitic and Pedro for Rafinha and Iniesta respectively, with Mascherano later coming on for Alves, who had endured an off day.
The changes failed to lift Barcelona sufficiently.
Their best opportunity came seven minutes from the end when Pedro found space down the right side of the area but smashed into the side-netting, and in injury time Suarez fired at Kameni but the goalkeeper saved well. The Cameroonian also denied Pique at the death, to preserve the three points.
Additional reporting from PA