Barcelona 4-2 Valencia: Lionel Messi at the double in scrappy victory

Lionel Messi scored twice as Barcelona kept their La Liga title hopes alive with a scrappy 4-2 victory at home to 10-man Valencia on Sunday night.

In a very erratic performance, Barca fell behind early on to an Eliaquim Mangala header but levelled the game through Luis Suarez. Mangala then went from hero to villain as he was sent off for a professional foul on Suarez and Messi scored from the penalty spot.

However, Luis Enrique's men struggled to adapt defensively to their 3-4-3 formation and Munir, who is on loan at Valencia from Barca, sensationally equalised just before half-time. The visitors dug in, but Messi and Andre Gomes scored in the second half to win the points.

Barcelona desperately needed a victory after losing ground in the title race with a surprise 2-1 defeat at Deportivo last weekend.

In the end, they should have won by more goals than they did - but they were all over the place defensively for the first hour.

Luis Enrique's three-man back line was caught out too often, with Munir denied by keeper Marc-Andre ter Stegen when clean through seconds before Mangala scored from the resulting corner.

Valencia were equally sloppy in defence, though. Ezequiel Garay was outpaced down their right by Suarez on more than one occasion, and the Uruguay international was quick to pounce for the equaliser when the visitors switched off at a Neymar throw-in.

Mangala, already on a yellow card, could have no complaints about his dismissal just before half-time.

Enrique, though, had plenty of reason to fume when his own defenders allowed Munir, on loan from Barcelona, all the time he wanted to turn in Jose Luis Gaya's pull-back.

Barcelona did not seem to know how to cover their right flank defensively, and Enrique eventually sent on Sergi Roberto in a move to a back four.

That settled the home side, who could have had plenty more goals - with Neymar going closest as he hit the post with a free-kick.

In the end, they settled for two in the second half; Messi - La Liga's leading scorer - caught out keeper Diego Alves with a near-post drive and substitute Gomes tapped in from Neymar's pass.