The Argentine, who holds the La Liga and Champions League scoring records, produced a now familiar devastating performance to take his record to 402 goals for Barca in all competitions, including 28 in friendlies.
He produced his tour de force, predictably, just a day after Cristiano Ronaldo, his rival for title of world's best player, scored a La Liga record 23rd hat-trick against Celta Vigo for Real Madrid.
Former Barca player Sergio Garcia put Espanyol ahead at the Nou Camp but Messi, who had earlier hit the crossbar with a free kick, equalised before halftime, his landmark 400th goal coming with a clinical strike from the edge of the area.
Shortly after the break, Luis Suarez found the Argentine and he again hit the corner of the net from a similar distance.
Espanyol were in disarray and Gerard Pique was allowed a free header from a corner to add to the lead after 53 minutes.
Substitute Pedro latched onto a long ball from Jordi Alba to grab another and, with nine minutes remaining, he set up Messi for a brilliantly executed third.
The win leaves Barca in second place in La Liga, two points behind Real Madrid.