On this day in 2014, Lionel Messi netted a hat-trick as Barcelona beat Real Madrid 4-3 in one of the greatest Clasico's of all-time.

Both sides went into the game at the Bernabeu with a lot on the line.

Madrid started the day four points above their fierce rivals and looking to extend their gap at the top of the table.

With just a few months left of the season, Barcelona had limited games to cut the gap and couldn't afford to lose at the home of their rivals. In fact, they had to win.

Both sides needed all three points and what entailed was an absolute thriller.

After just seven minutes, Messi fed Andres Iniesta through on goal, who smashed his effort past Diego Lopez to give his side the lead.

But Real Madrid battled back and took the lead themselves shortly after, with Karim Benzema notching twice in four minutes.

The two sides would go into the break level, though. Messi netted in the 42nd minute to end what was a wild first-half.

Amazingly, the second-half was even more chaotic.

Cristiano Ronaldo went down in the box and then converted the resulting penalty to give his side the lead once again.

But it would all fall apart for Los Blancos after that.

Sergio Ramos was given his marching orders when he took down Neymar inside the box. Messi made no mistake to restore parity.

And Messi would find himself having another golden opportunity when Xabi Alonso felled Iniesta in the box.

There was so much riding on the spot-kick but Messi was up to the task as he fired his effort into the net, completing his hat-trick in the process.

Barcelona held on the remaining five minutes to clinch what was an important victory.

Watch highlights of the game below:

Messi's hat-trick made him the highest goalscorer in El Clasico history.

It was also his second hat-trick in a row and made him the second highest scorer in La Liga history.

That result got Barca back in the title race. But they were still one-point behind Atletico and Real Madrid with nine games remaining.

And it was Diego Simeone's side that would hold on to claim their first Spanish title in 18 years.