Barcelona got another derby win, after a forgettable first half for the La Liga leaders, when Messi sparked the clash into life after the break, forcing two saves from Espanyol goal keeper Diego Lòpez.
The Argentinian broke the deadlock on 70 minutes with a superb free kick, after he has hacked down by Vìctor Sànchez, chipping over Lopez's wall and into the net - despite Sànchez's best efforts to clear off the line.
The Barcelona skipper secured all three points for the home side with two minutes to go, slotting home from substitute Malcom's pass when Espanyol pushed forward for an equaliser.
Messi now has 31 La Liga goals for the 2018-19 campaign, and he is line to finish the season with his highest league tally since the 2014-15 season.