With 14 minutes remaining of a difficult afternoon for Gerardo Martino's side, the prolific Argentina forward calmly sent his spot-kick the other side of Espanyol goalkeeper Kiko Casilla, who was then sent off for handling another shot from Messi outside his area.
Defender Javi Lopez, who had given away the penalty, went in goal for the remaining eight minutes, but Barca were unable to take further advantage.
"We were expecting a game like this," said Barca coach Tata Martino. "Espanyol's pressure improved and we had to resort to longer passes. Espanyol are very well prepared to take control of follow-up plays."