Messi opened the scoring with a fine free-kick before Ousmane Dembele doubled the lead on 26 minutes and Luis Suarez scored from the tightest of angles just before half-time.
The win cements Barcelona's place at the La Liga summit, while Espanyoldrop to ninth after slipping to a fourth consecutive league defeat.
Dembele was sent clear before feeding Messi in a crowded Espanyol penalty area and his shot was blocked by Diego Lopez.
Barcelona have made one change for their clash with Espanyol on Saturday evening.
EspanyoldefenderOscar Duarte fouled the Barcelona playmaker 25 yards out in a central position.
Messi repeated his magic with another free kick in the 64th minute to put the icing on the cake for a very satisfying night for Barca, while Espanyol have now lost their last four matches.
Barcelona were caught out at the back in the 74th minute when Duarte stabbed the ball in at close range from a free-kick.
Dembele was again involved for the Spanish champions, with the Frenchman's through pass releasing Luis Suarez, who squeezed a low attempt through the legs of Diego Lopez.
Understandably, Barca took their foot off the gas in the second half, though the feeling that they could re-find their intensity and cutting edge at a moment's notice remained.
Barcelona go into the game against Espanyol having beaten Cultural Leonesa 4-1 in the Copa del Rey, with some key players, including Suarez, having been rested for that fixture.
Victor Sanchez headed over the Barcelona crossbar 10 minutes from time as Espanyol continued to search for a goal, and it nearly arrived when Baptistao struck towards the far corner, but the ball just deflected wide.
Messi was in fine form against derby rivals Espanyol.