The visitors gave their city rivals a tough game at the Camp Nou, but Messi’s chipped free-kick with 19 minutes to play and a late second sent the reigning champions 13 points clear at the top ahead of second-placed Atletico Madrid’s game at Alaves later on Saturday.
Messi has now netted eight times in his last four games for Barca, and leads the way in the La Liga scoring charts with 31 goals, 13 ahead of teammate Luis Suarez.
“I had no idea he would hit (the free-kick) like that,” said Barcelona coach Ernesto Valverde.
“I would love to say that we had planned it, but it’s not true, it’s up to him. He didn’t need my opinion and he scored.”
It was a fitting way for the Argentinian to mark his 675th Barcelona appearance, which moved him ahead of Andres Iniesta into second on the club’s all-time list — 102 adrift of Xavi Hernandez.
He made a low-key return to international action in midweek as Argentina lost a friendly to Venezuela, but Valverde was delighted it did not affect Messi on Saturday.
“Messi is the same player no matter what team he is playing in,” he said.
“He would be the same if he played in Australia… We are delighted to have him, it’s a luxury for me to coach him.”
– Barca frustrated –
Barca struggled to break down Espanyol early on, with Messi, Suarez and Ivan Rakitic all wasting half-chances in the first period.
Barcelona saw a penalty appeal waved away by both the referee and VAR on the stroke of half-time, and Malcom was denied just after the hour mark by away goalkeeper Diego Lopez as the Catalan giants grew frustrated.
But Messi has been consistently unplayable this season, and he dinked in a wonderful effort from a set-piece despite Victor Sanchez’s best efforts to clear off the line.
The three points were sealed in the 89th minute as Malcom ran clear on the breakaway, before cutting the ball across for Messi to sweep a trademark finish low into the bottom corner.
Barcelona next visit Villarreal on Tuesday with a second successive title looking even more like a mere formality after a sixth straight victory extended their unbeaten league run to 17 matches.
Earlier on Saturday, fourth-placed Getafe missed the chance to solidify their spot in the Champions League places as they slumped to a 2-0 home defeat by Leganes.
Uruguayan Michael Santos and Spaniard Juanfran scored in the second half for Leganes to give Alaves the chance to move into the top four with a win over Atletico.