The striker capitalised on a stray back pass from Dani Alves to hand the visitors a shock win as the hosts wasted an opportunity to move within a point of leaders Real Madrid
Malaga claimed a 0-0 draw after successfully nullifying Lionel Messi and Neymar when the two sides met at La Rosaleda in September and they produced a fine display to claim their first Camp Nou victory since 1999.
Luis Suarez, who missed their last meeting, was unable to inspire a change in Barca's fortunes this time around, as their usually lethal frontline struggled after Juanmi capitalised on an early Dani Alves error to break the deadlock.
The hosts unsurprisingly dictated the tempo of the match, though Malaga's hard-working defence held firm in admirable fashion, while Javi Garcia's side posed a significant threat on the break.
Rafinha and Andres Iniesta saw Barca's best chances go begging in the first half, while opportunities were even rarer after the break, as Malaga proved impenetrable.
The visitors ultimately scraped over the finish line to claim a famous and surprising win despite Barca's intense late pressure, sealing a result that will raise smiles at title rivals Real Madrid.
Despite resting few key players in the lead up to Tuesday's Champions League trip to Manchester City, Barca trailed after just seven minutes, proving to be their own worst enemy.
Dani Alves sold Claudio Bravo short with a poor back-pass and Juanmi pounced, skipping beyond the goalkeeper before prodding home, doing little to help the Brazilian's bid for a new contract.
Barca almost hit back just two minutes later, but Weligton, who infamously clashed with Messi in this season's reverse fixture, crucially blocked Rafinha's powerful goal-bound effort.
Though the hosts continued to dominate, Malaga's dogged defending ensured that clear-cut opportunities were few and far between.
And the visitors proved particularly dangerous on the counter-attack, nearly adding to their lead twice in quick succession just after the half-hour mark.
Barca should have restored parity five minutes before the interval, though Iniesta could only send his tame header straight at Carlos Kameni.
The hosts' monopoly of the ball continued into the second half without much to show for their efforts, as the impressive Weligton and Roberto Rosales remained solid at the back.
Neymar and Messi attempted to force the issue, driving forward with intent and forcing the Malaga defence back, but generally the hosts' final ball fell flat, as opportunities eluded Luis Enrique's men.
Substitute Pedro sent their best chance into the side netting, leaving Luis Enrique with much to ponder ahead of their trip to face Premier League champions Manchester City in the Champions League next week.