Barcelona hit five past Sociedad
Real had gone a point clear thanks to a 3-1 success at bottom side Real Zaragoza, Cristiano Ronaldo blasting in a free-kick between goals from Mesut Ozil and Angel Di Maria.
Barca responded in style with another crushing win, a ninth straight league victory for Pep Guardiola's side that took their goal tally to 26 in their last six matches in all competitions.
Messi's brace lifted him to 17 for the season after 15 games, level with Real's Ronaldo.
Barca have 40 points to Real's 38 and the La Liga giants pulled further away at the top of the standings after Villarreal and Espanyol both lost.
Villarreal went down 1-0 at Getafe on Saturday and are eight behind Real, while Espanyol, who squandered the lead to lose 2-1 at Athletic Bilbao on Sunday, are two further back in fourth.
Barca were already two goals to the good at the Nou Camp when Messi bagged his first of the night in the 47th minute after a move of breathtaking skill.
He exchanged close passes six times with Brazil full-back Daniel Alves as they sliced through the Sociedad defence for the Argentine World Player of the Year to finish cooly past goalkeeper Claudio Bravo.
His pace and trickery were too much for the visitors and he left at least four Sociedad players for dead when he waltzed across the penalty area and clipped the ball into the net for his second and Barca's fourth in the 87th minute.
David Villa had put them ahead in the ninth minute when Messi sent Pedro clear and the Spain striker diverted his international team mate's cross high into the net.
Pedro chalked up another assist for Barca's second in the 33rd minute when he played a one-two with Andres Iniesta and the Ballon d'Or nominee beat Bravo at his near post.
Substitute Bojan Krkic completed the rout in added time when he finished at the second attempt.
"We have returned to playing at a fantastic level," Messi said in an interview with Spanish television. "We have worked hard and have a very good team with great players."
Portuguese forward Ronaldo had earlier scored a trademark dipping freekick as Real appeared to have shrugged off any psychological effects from their 5-0 drubbing at Barca at the end of last month.
Ozil opened the scoring in the 15th minute at Zaragoza's Romareda stadium, Ronaldo added the second just before half-time and Di Maria made it three shortly after the break.
Gabi Fernandez pulled a goal back for the home side from the penalty spot in the 54th minute.