For Barcelona, it was the perfect script. Messi's goal with the last kick of the game, the 500th of his career, helped bury rivals Real Madrid and Cristiano Ronaldo. The 3-2 victory saw Luis Enrique's side leapfrog "Los Blancos" at the top of the table as the season enters its final stages.
In a seesaw game, Casemiro gave Madrid the lead before Messi leveled. A thunderous strike from Croatian Ivan Rakitic gave Barcelona the advantage, before James Rodriguez seemed to have secured a point for 10-man Madrid with five minutes remaining.
But then up stepped Messi, stroking the ball into the bottom corner to finish off a sweeping Barcelona counter-attack.
From howling misses to honoring a landmark, red cards to raucous celebrations, here's how social media reacted to the drama in Madrid.
The fourth meeting between these two teams this season certainly lived up to the fixture's fiery reputation. Messi received an elbow to the face from Madrid's Marcelo, causing the Argentine to play with a tissue in his mouth to stem the bleeding.
Soon after, Sergio Ramos received a red card with 15 minutes remaining for this challenge on Messi. It was the fifth time Ramos has been sent off in this fixture and the 22nd red card of his career.
The defender drew joking criticism on Twitter for the tackle.
He had been bloodied and bruised, but now it was Messi's turn to strike his rivals as he calmly slotted the ball past Keylor Navas.
Cue raucous celebrations in Barcelona. Fans watching in the Camp Nou went wild.
Barcelona star Neymar, who was serving a three-match suspension, joined the party when he was video-called by his teammates from the changing room.
For Messi, his second goal of the match marked a landmark 500 goals in 577 games.
As he took his shirt off in celebration, social media was quick to react humorously.
While Ronaldo had reached his own landmark earlier in the week -- scoring the 100th Champions League goal of his career against Bayern Munich -- he was upstaged by his rival on this occasion.
The low point came when the Madrid star missed a simple chance from a few yards out midway through the second half.
The result also gave spectators chance to once again reference the bust of the Portuguese recently unveiled in Madeira airport.
Barcelona is now level on league points with Madrid but ahead on goal difference. Madrid has a game in hand, but faces a potential banana skin encounter against Sevilla in May.
It's all to play for in La Liga.