It only took 11 minutes for Messi to open the scoring and claim another record.
Raoul Loe levelled the game on 24 minutes against the run of play, but the side from Pamplona were left with 10 men three minutes later when centre-half Alejandro Arribas received a second yellow card after a shot struck his hand in the area.
Messi coolly slotted away the penalty for his second and Pedro Rodriguez made it three before halftime.
The Argentine recorded his hat-trick on 56 minutes when he started a move in midfield, exchanged passes with Villa, and took the ball around the keeper before slotting home.
And a minute later, it was five as he finished off a swift Barca attack and Adriano pass from close range.
All Real's goals came in a much improved second-half performance in the derby against Getafe, with Ronaldo scoring three in 10 minutes.
Also yesterday, Malaga moved into fourth with a 3-2 win at Mallorca, and Rayo Vallecano beat Real Betis 3-0 to move into sixth, a place and a point behind the Seville-based side.
-AAP