Barcelona breathed new life into their La Liga title hopes as a Lionel Messi hat-trick helped fire them to victory in a thrilling match at 10-man Real Madrid.

Andres Iniesta shot into the top corner before Karim Benzema's brace put Real ahead.

Messi restored parity soon after but Cristiano Ronaldo restored Real's lead from the penalty spot.

After Sergio Ramos was sent off, Messi won the game with two penalties.

Did you know?

Gerardo Martino became the fifth coach to win in his first trip to the Bernabeu in charge of Barca. The only managers to achieve that before have been Terry Venables, Louis van Gaal, Frank Rijkaard and Pep Guardiola.

It was Messi's second hat-trick in a row as he became the second highest scorer in La Liga history, moving ahead of former Real striker Hugo Sanchez onto 236 goals.

The Argentine also became the all-time top scorer in Clasicos with 21 goals, surpassing Real legend Alfredo Di Stefano, as Barcelona moved to within one point of Sunday's opponents.

Messi has produced some indifferent performances this year but he has been back to his best lately with an inspirational performance in Barca's Champions League passage past Manchester City followed by successive league trebles.

Barcelona celebrate

Atletico Madrid's 2-0 win at Real Betis earlier on Sunday means they top La Liga, level on points with city rivals Real but ahead on their head-to-head record this season, but Barca are now within a point of both.

The defending champions travelled to the Bernabeu having lost two of their last four league matches, while Real had not been defeated in their last 31 matches in all competitions.

But Barcelona signalled their early intent through a brilliant early strike into the top corner by Iniesta, after Messi's precise through ball.

Real, who had won their last 17 matches in a row at the Bernabeu, were soon ahead as Benzema made up for an early miss with a quick-fire double.

Did you know?

It is 27 years since a league game between Real Madrid and Barca has ended without score at the Santiago Bernabeu.

First he headed home Angel Di Maria's cross and then, four minutes later, the pair combined again as the Frenchman controlled on his thigh before slotting the ball into the net.

For a match that meant so much to both sides, it was surprisingly open and Barca had Gerard Pique to thank for not going further behind as he cleared Benzema's effort off the line.

Neither side looked sure defensively and, just before the break, Messi cut inside the area to fire the visitors level to cap a thrilling half of football.

Real were ahead again in controversial circumstances soon after the restart, as Ronaldo scored from the penalty spot despite being tripped by Dani Alves just outside the penalty area.

Cristiano Ronaldo of Real Madrid

The match swung again though when Ramos was shown a straight red card for fouling Neymar, allowing Messi to equalise from the penalty spot.

Alves then hit the post as Real looked content to hold out for the draw before Messi won the game, again from the spot, after Iniesta was sandwiched by Xabi Alonso and Dani Carvajal.

Barcelona have won six of their last 11 league fixtures at the Bernabeu and, also through to the quarter-finals of the Champions League, they will believe they can go on to defend their La Liga title.

Lineup, Bookings (8) & Substitutions (5)

Real Madrid

  • 25 López
  • 15 Carvajal
  • 12 Marcelo
  • 14 Alonso Booked
  • 03 Pepe Booked
  • 04 Ramos Dismissed
  • 19 Modric Booked (Morata - 90' )
  • 22 Di María Booked (Isco - 85' )
  • 09 Benzema (Varane - 66' )
  • 11 Bale
  • 07 Ronaldo Booked

Substitutes

  • 01 Casillas
  • 02 Varane
  • 05 Fábio Coentrão
  • 18 Nacho
  • 21 Morata
  • 23 Isco
  • 24 Illarramendi

Barcelona

  • 01 Valdés
  • 22 Dani Alves
  • 18 Alba
  • 16 Busquets Booked
  • 14 Mascherano
  • 03 Piqué
  • 06 Xavi
  • 04 Fábregas Booked (Sánchez - 78' )
  • 10 Messi
  • 11 Neymar (Pedro - 69' )
  • 08 Iniesta

Substitutes

  • 07 Pedro
  • 09 Sánchez
  • 13 Pinto Colorado
  • 15 Bartra
  • 17 Song
  • 21 Adriano
  • 24 Sergi
Ref: Alberto Undiano Mallenco
Att: 85,454

Match Stats

Shots

13 18

On target

8 6

Corners

1 5

Fouls

24 12

Live Text Commentary

Full time

Full Time Match ends, Real Madrid 3, Barcelona 4.

90:00 +2:58 Full time

Full Time Second Half ends, Real Madrid 3, Barcelona 4.

90:00 +2:57

Lionel Messi (Barcelona) wins a free kick in the defensive half.

90:00 +2:57

Foul by Álvaro Morata (Real Madrid).

90:00 +2:28

Offside, Barcelona. Alexis Sánchez tries a through ball, but Dani Alves is caught offside.

90:00 +2:27

Attempt missed. Alexis Sánchez (Barcelona) right footed shot from the centre of the box misses to the left. Assisted by Lionel Messi.

90:00 +1:18

Sergio Busquets (Barcelona) wins a free kick in the defensive half.

90:00 +1:18

Foul by Gareth Bale (Real Madrid).

90:00 +0:35

Xavi (Barcelona) wins a free kick on the left wing.

90:00 +0:35

Foul by Xabi Alonso (Real Madrid).

89:20 Substitution

Substitution Substitution, Real Madrid. Álvaro Morata replaces Luka Modric.

89:03

Foul by Pedro (Barcelona).

89:03

Daniel Carvajal (Real Madrid) wins a free kick on the right wing.

87:38 Booking

Booking Luka Modric (Real Madrid) is shown the yellow card for a bad foul.

87:31

Lionel Messi (Barcelona) wins a free kick in the attacking half.

87:31

Foul by Luka Modric (Real Madrid).

86:43

Andrés Iniesta (Barcelona) wins a free kick in the defensive half.

86:43

Foul by Isco (Real Madrid).

85:53

Offside, Barcelona. Dani Alves tries a through ball, but Alexis Sánchez is caught offside.

84:58 Booking

Booking Cristiano Ronaldo (Real Madrid) is shown the yellow card for a bad foul.

84:55

Javier Mascherano (Barcelona) wins a free kick in the defensive half.

84:55

Foul by Cristiano Ronaldo (Real Madrid).

84:36 Substitution

Substitution Substitution, Real Madrid. Isco replaces Ángel Di María.

84:17 Booking

Booking Xabi Alonso (Real Madrid) is shown the yellow card.

83:40 Goal scored

Goal! Goal! Real Madrid 3, Barcelona 4. Lionel Messi (Barcelona) converts the penalty with a left footed shot to the top right corner.

82:27

Penalty Barcelona. Andrés Iniesta draws a foul in the penalty area.

82:27

Penalty conceded by Xabi Alonso (Real Madrid) after a foul in the penalty area.

81:17

Attempt missed. Javier Mascherano (Barcelona) right footed shot from outside the box is just a bit too high. Assisted by Sergio Busquets.

80:40

Jordi Alba (Barcelona) wins a free kick in the defensive half.

80:40

Foul by Luka Modric (Real Madrid).

79:21

Foul by Javier Mascherano (Barcelona).

79:21

Cristiano Ronaldo (Real Madrid) wins a free kick in the defensive half.

77:30 Substitution

Substitution Substitution, Barcelona. Alexis Sánchez replaces Francesc Fábregas.

75:54

Foul by Javier Mascherano (Barcelona).

75:54

Cristiano Ronaldo (Real Madrid) wins a free kick in the attacking half.

73:34

Dani Alves (Barcelona) hits the left post with a right footed shot from outside the box. Assisted by Lionel Messi.

72:22

Attempt blocked. Lionel Messi (Barcelona) left footed shot from the centre of the box is blocked. Assisted by Andrés Iniesta.

71:18

Attempt missed. Sergio Busquets (Barcelona) header from the centre of the box is too high. Assisted by Xavi with a cross following a corner.

70:55

Corner, Barcelona. Conceded by Daniel Carvajal.

69:29

Foul by Francesc Fábregas (Barcelona).

69:29

Pepe (Real Madrid) wins a free kick in the defensive half.

68:23

Jordi Alba (Barcelona) wins a free kick in the defensive half.

68:23

Foul by Gareth Bale (Real Madrid).

68:05 Substitution

Substitution Substitution, Barcelona. Pedro replaces Neymar.

67:26

Foul by Francesc Fábregas (Barcelona).

67:26

Luka Modric (Real Madrid) wins a free kick in the defensive half.

67:19

Attempt blocked. Andrés Iniesta (Barcelona) right footed shot from outside the box is blocked. Assisted by Sergio Busquets.

65:31 Booking

Booking Sergio Busquets (Barcelona) is shown the yellow card for a bad foul.

65:22

Foul by Sergio Busquets (Barcelona).

65:22

Daniel Carvajal (Real Madrid) wins a free kick in the attacking half.

65:03 Substitution

Substitution Substitution, Real Madrid. Raphael Varane replaces Karim Benzema.

64:06 Goal scored

Goal! Goal! Real Madrid 3, Barcelona 3. Lionel Messi (Barcelona) converts the penalty with a left footed shot to the bottom right corner.

62:48 Dismissal

Dismissal Sergio Ramos (Real Madrid) is shown the red card.

62:42

Penalty Barcelona. Neymar draws a foul in the penalty area.

62:42

Penalty conceded by Sergio Ramos (Real Madrid) after a foul in the penalty area.

60:52

Attempt saved. Neymar (Barcelona) left footed shot from outside the box is saved in the centre of the goal. Assisted by Francesc Fábregas.

59:54

Corner, Barcelona. Conceded by Gareth Bale.

59:53

Attempt blocked. Andrés Iniesta (Barcelona) left footed shot from outside the box is blocked.

59:17

Corner, Barcelona. Conceded by Marcelo.

57:39

Corner, Real Madrid. Conceded by Víctor Valdés.

57:37

Attempt saved. Gareth Bale (Real Madrid) right footed shot from a difficult angle on the right is saved in the centre of the goal. Assisted by Karim Benzema with a through ball.

57:15

Foul by Javier Mascherano (Barcelona).

57:15

Ángel Di María (Real Madrid) wins a free kick in the attacking half.

56:03

Lionel Messi (Barcelona) wins a free kick on the right wing.

56:03

Foul by Xabi Alonso (Real Madrid).

54:18 Goal scored

Goal! Goal! Real Madrid 3, Barcelona 2. Cristiano Ronaldo (Real Madrid) converts the penalty with a right footed shot to the bottom left corner.

53:25

Penalty conceded by Dani Alves (Barcelona) after a foul in the penalty area.

53:25

Penalty Real Madrid. Cristiano Ronaldo draws a foul in the penalty area.

52:03

Sergio Busquets (Barcelona) wins a free kick in the defensive half.

52:03

Foul by Gareth Bale (Real Madrid).

51:54

Attempt saved. Karim Benzema (Real Madrid) right footed shot from the centre of the box is saved in the bottom left corner. Assisted by Gareth Bale with a through ball.

49:15

Sergio Busquets (Barcelona) wins a free kick in the defensive half.

49:15

Foul by Luka Modric (Real Madrid).

48:50

Foul by Gerard Piqué (Barcelona).

48:50

Pepe (Real Madrid) wins a free kick in the defensive half.

48:10

Corner, Barcelona. Conceded by Sergio Ramos.

45:00

Second Half begins Real Madrid 2, Barcelona 2.

45:00 +1:00 Half time

Half Time First Half ends, Real Madrid 2, Barcelona 2.

45:00 +0:24

Attempt missed. Karim Benzema (Real Madrid) header from the centre of the box is close, but misses to the right. Assisted by Daniel Carvajal with a cross.

42:37 Booking

Booking Francesc Fábregas (Barcelona) is shown the yellow card.

42:37 Booking

Booking Pepe (Real Madrid) is shown the yellow card.

41:39 Goal scored

Goal! Goal! Real Madrid 2, Barcelona 2. Lionel Messi (Barcelona) left footed shot from the centre of the box to the bottom right corner.

40:40

Foul by Neymar (Barcelona).

40:40

Ángel Di María (Real Madrid) wins a free kick in the defensive half.

39:47

Attempt blocked. Gerard Piqué (Barcelona) header from the centre of the box is blocked. Assisted by Xavi with a cross.

39:18

Corner, Barcelona. Conceded by Daniel Carvajal.

38:05

Gerard Piqué (Barcelona) wins a free kick in the defensive half.

38:05

Foul by Cristiano Ronaldo (Real Madrid).

34:17 Booking

Booking Ángel Di María (Real Madrid) is shown the yellow card for a bad foul.

34:14

Neymar (Barcelona) wins a free kick on the left wing.

34:14

Foul by Ángel Di María (Real Madrid).

29:46

Attempt blocked. Xavi (Barcelona) right footed shot from outside the box is blocked.

28:27

Hand ball by Ángel Di María (Real Madrid).

28:00

Xavi (Barcelona) wins a free kick on the right wing.

28:00

Foul by Xabi Alonso (Real Madrid).

27:23

Neymar (Barcelona) wins a free kick in the defensive half.

27:23

Dangerous play by Ángel Di María (Real Madrid).

26:54

Attempt missed. Luka Modric (Real Madrid) left footed shot from outside the box is too high following a set piece situation.

26:52

Attempt blocked. Cristiano Ronaldo (Real Madrid) right footed shot from outside the box is blocked.

25:58

Foul by Javier Mascherano (Barcelona).

25:58

Ángel Di María (Real Madrid) wins a free kick in the attacking half.

25:51

Attempt blocked. Karim Benzema (Real Madrid) left footed shot from the centre of the box is blocked. Assisted by Ángel Di María with a cross.

25:33

Attempt blocked. Lionel Messi (Barcelona) left footed shot from outside the box is blocked.

24:32

Lionel Messi (Barcelona) wins a free kick in the attacking half.

24:32

Foul by Sergio Ramos (Real Madrid).

24:24

Francesc Fábregas (Barcelona) wins a free kick on the left wing.

24:24

Foul by Daniel Carvajal (Real Madrid).

23:05 Goal scored

Goal! Goal! Real Madrid 2, Barcelona 1. Karim Benzema (Real Madrid) right footed shot from the centre of the box to the bottom right corner. Assisted by Ángel Di María with a cross.

22:14

Sergio Busquets (Barcelona) wins a free kick in the defensive half.

22:14

Foul by Karim Benzema (Real Madrid).

21:51

Delay over. They are ready to continue.

20:45

Delay in match Ángel Di María (Real Madrid) because of an injury.

19:39 Goal scored

Goal! Goal! Real Madrid 1, Barcelona 1. Karim Benzema (Real Madrid) header from the centre of the box to the bottom right corner. Assisted by Ángel Di María with a cross.

18:39

Foul by Neymar (Barcelona).

18:39

Marcelo (Real Madrid) wins a free kick in the defensive half.

18:36

Attempt blocked. Neymar (Barcelona) left footed shot from the centre of the box is blocked. Assisted by Lionel Messi with a through ball.

17:45

Attempt saved. Cristiano Ronaldo (Real Madrid) right footed shot from outside the box is saved in the centre of the goal. Assisted by Karim Benzema.

15:41

Dani Alves (Barcelona) wins a free kick in the defensive half.

15:41

Foul by Xabi Alonso (Real Madrid).

14:40

Attempt missed. Lionel Messi (Barcelona) left footed shot from the centre of the box is close, but misses to the right. Assisted by Francesc Fábregas with a through ball.

13:01

Andrés Iniesta (Barcelona) wins a free kick in the defensive half.

13:01

Foul by Daniel Carvajal (Real Madrid).

11:59

Attempt missed. Karim Benzema (Real Madrid) left footed shot from the centre of the box is too high. Assisted by Ángel Di María.

11:33

Attempt saved. Karim Benzema (Real Madrid) right footed shot from outside the box is saved in the centre of the goal. Assisted by Gareth Bale.

6:13 Goal scored

Goal! Goal! Real Madrid 0, Barcelona 1. Andrés Iniesta (Barcelona) left footed shot from the centre of the box to the top right corner. Assisted by Lionel Messi.

4:04

Attempt missed. Karim Benzema (Real Madrid) left footed shot from the right side of the box is close, but misses to the right. Assisted by Gareth Bale.

3:19

Attempt saved. Neymar (Barcelona) right footed shot from the right side of the box is saved in the bottom right corner.

0:42

Sergio Busquets (Barcelona) wins a free kick in the defensive half.

0:42

Foul by Ángel Di María (Real Madrid).

0:00

First Half begins.

0:00

Lineups are announced and players are warming up.

Live data and text provided by our data suppliers