Match ends, Málaga 1, Barcelona 2.
Lionel Messi returned from injury to send Barcelona back to the top of La Liga as they won at Malaga.
Messi missed the midweek Copa Del Rey win at Athletic Bilbao with a hamstring problem, but came back to volley in Adriano's cross for the decisive goal.
Munir El Haddadi gave Barca the lead with a tap-in after 70 seconds.
Poor defending allowed Juanpi to equalise for Malaga, before Messi sent Barca a point clear of Atletico Madrid, who host Sevilla on Sunday.
Messi makes the difference
Barcelona were looking to strike a psychological blow in the title race, with Saturday morning leaders Atletico Madrid visiting the Nou Camp next weekend for a pivotal La Liga fixture.
They were grateful that Messi recovered in time to help them at La Rosaleda, although they had to make do without Neymar, who suffered a hamstring injury of his own during the week.
His replacement, Munir, got Barcelona off to the perfect start after the industrious Luis Suarez had got to the byeline to pull the ball back.
Messi was relatively quiet for much of the first half, aside from one clear chance just before half-time, when Miguel Torres made a magnificent block to deny him after Carlos Kameni had saved from Munir.
The Argentina international's brilliance, though, came to the fore with a wonderfully-fashioned scissors volley for the winner six minutes into the second half.
Messi did later pick up a deserved booking for a late challenge on Ignacio Camacho, but he had already proved that, even when he is not at his best, he can still be a match-winner.
Barca's defence muddles through
It has not been the most straightforward few days for Barcelona, with central defender Javier Mascherano appearing in court during the week aiming to avoid a prison sentence after admitting two counts of tax fraud.
On the field, Barca had to make do without Mascherano's regular defensive partner Gerard Pique, who was suspended, and they looked all over the place at the back in the first half.
Thomas Vermaelen, Pique's replacement, had a horrible 45 minutes before he was replaced by Jeremy Mathieu, who is fit again after a recent calf injury.
The former Arsenal defender struggled in the air against Malaga's Brazilian forward Charles. In one incident, the striker was left with a clear run to goal after Vermaelen stumbled and fell backwards as the ball came towards him; only a well-timed Mascherano challenge saved a goal.
Mascherano was culpable for Malaga's equaliser; playing a poor ball out of defence that allowed Charles to set up Juanpi, and then deflecting the shot past a helpless Claudio Bravo.
In such testing circumstances, Barca did well to come out with a win; they will certainly be relieved to have Pique back to face Atletico.
Malaga run out of steam
Having conceded so early, Malaga could have let their heads drop, but instead responded by throwing everything at Barcelona's wobbly defence.
Javi Gracia's team had been unsettled in the build-up to the game by the sale of winger Nordin Amrabat to Watford. The loss of such a creative player raised questions as to where their attacking threat might come from.
Yet they edged the first half, with Chory Castro unlucky to see his bouncing shot turned on to the post by Bravo before Juanpi equalised.
They seemed to tire after half-time - a sign that their efforts in matching Barcelona had come at a cost - although Camacho still almost found a second equaliser with a snapshot that Bravo saved well.
Gracia's side were in the relegation zone at the end of November, before a four-match winning streak pulled them clear. Despite suffering a second successive defeat here, they appear to have enough about them to stay out of trouble.
Barcelona host Atletico Madrid in a key match at the top of La Liga next Saturday, when Malaga will seek to end a three-match winless run at Eibar.
- 3Pena de OliveiraSubstituted forBarbosa Valenteat 83'minutesBooked at 90mins
- 28Añor Acosta
- 14García del PozoSubstituted forFornalsat 69'minutesBooked at 86mins
- 9Dias de OliveiraBooked at 25mins
- 20CopSubstituted forSanta Cruzat 80'minutes
- 10da Luz Horta
- 17Barbosa Valente
- 24Santa Cruz
- 22Vidal Parreu
- 23VermaelenBooked at 44minsSubstituted forMathieuat 45'minutes
- 21CorreiaSubstituted forRoberto Carnicerat 72'minutes
- 7TuranBooked at 71mins
- 10MessiBooked at 65mins
- 17El HaddadiSubstituted forRakiticat 56'minutes
- 1ter Stegen
- 6Alves da Silva
- 20Roberto Carnicer
- Carlos Clos Gómez
- Shots on Target
Second Half ends, Málaga 1, Barcelona 2.
Duda (Málaga) is shown the yellow card for a bad foul.
Lionel Messi (Barcelona) wins a free kick on the right wing.
Foul by Duda (Málaga).
Attempt saved. Gonzalo Castro (Málaga) left footed shot from a difficult angle on the left is saved in the bottom left corner. Assisted by Charles.
Offside, Barcelona. Andrés Iniesta tries a through ball, but Lionel Messi is caught offside.
Arda Turan (Barcelona) wins a free kick on the left wing.
Foul by Roberto Rosales (Málaga).
Attempt missed. Arda Turan (Barcelona) right footed shot from the centre of the box misses to the right. Assisted by Aleix Vidal with a cross.
Jeremy Mathieu (Barcelona) wins a free kick in the defensive half.
Foul by Charles (Málaga).
Attempt saved. Lionel Messi (Barcelona) left footed shot from the centre of the box is saved in the centre of the goal. Assisted by Ivan Rakitic with a cross.
Corner, Barcelona. Conceded by Roque Santa Cruz.
Attempt blocked. Lionel Messi (Barcelona) left footed shot from outside the box is blocked.
Pablo Fornals (Málaga) is shown the yellow card for a bad foul.
Andrés Iniesta (Barcelona) wins a free kick in the attacking half.
Foul by Pablo Fornals (Málaga).
Attempt missed. Charles (Málaga) left footed shot from the centre of the box is too high. Assisted by Gonzalo Castro with a cross.
Substitution, Málaga. Duda replaces Weligton.