Elsewhere, Antoine Griezmann struck twice as Atletico Madrid produced a devastating performance to sweep Almeria aside 3-0 and move within four points of leaders Real Madrid who play their game in hand at Elche on Sunday.
The stage was left clear for a Barca victory to take them two points ahead of Real but they were unable to reproduce the slick football that has seen them terrorise opponents recently.
“In football we know anything can happen. You are on a good run and then suddenly you lose,” defender Gerard Pique told reporters.
“We are playing well and just because we have lost one game doesn’t mean that everything is now bad.”
Seventh-placed Malaga grabbed the only goal when Alves tried to nonchalantly side-foot a back pass but Juanmi nipped in and rounded keeper Claudio Bravo before slotting the ball into an empty net after seven minutes.
Lionel Messi had scored 12 goals in the previous eight games but could not provide a spark as Barca dominated possession without finding a way past a steadfast Malaga defence.
“It wasn’t the best game not only from Leo but all the team,” said midfielder Sergio Busquets. “We needed to create more chances and goals but it wasn’t possible.”
Messi, Neymar and Luis Suarez were in Barca’s starting lineup as coach Luis Enrique decided against resting his first-choice forwards ahead of the midweek trip to Manchester City in the Champions League last 16.
However, the trio could make little impact against a disciplined Malaga.
“We will face a different type of team in the Champions League,” said Busquets.
Barca almost levelled straight after conceding the early goal when Rafinha’s drive from the edge of the area was cleared off the line.
The expected onslaught from Barca never materialised and most surprising was the performance of Messi who repeatedly gavethe ball away.
Substitute Pedro Rodriguez wasted a late chance to grab an equaliser when his shot from inside the area hit the side-netting.
Atletico showed the intensity that was missing in their defeat last weekend by Celta Vigo and victory over Almeria never looked in doubt after Mario Mandzukic converted a 13th-minute penalty following a foul by Tomer Hemed on Diego Godin.
Mandzukic was then twice the provider for a clinical Griezmann who struck after 20 and 29 minutes before Atletico eased off in the second half.
In injury time Atletico full back Guilherme Siqueira was dismissed after receiving a second yellow card for handball.
“It was vital for our situation and morale to win after the Vigo result,” said coach Diego Simeone before repeating again that his target was to finish third.
“We are only thinking of the fight with Sevilla and Valencia. We all know there is much more to the league than just Madrid and Barcelona.”
Fourth-placed Valencia kept their Champions League hopes on track after a late Pablo Piatti strike earned a 2-1 victory at Cordoba.
Nabil Ghilas had converted a penalty, following a foul by Nicolas Otamendi on Heldon Ramos, to bring Cordoba level midway through the second half after Andre Gomes’ opener.
Piatti then fortuitously got the winner nine minutes from the end as he struck a volley into the ground and it looped over Mikel Saizar into the net.
Second-half goals from Charles Dias and Joaquin Larrivey gave eighth-placed Celta a 2-0 victory at Deportivo La Coruna who had defender Alberto Lopo sent off in the 73rd minute.
(Editing by Tony Jimenez)