Ruben Castro gave the visitors the lead by converting a 78th-minute penalty kick, but Javi Fuego equalized in the 87th and Jose Antonio Reyes netted a 90th-minute winner with a superb shot into the upper corner.
''I hit that shot with my soul,'' Reyes said. ''You have to hit it with your soul.''
The result moved Espanyol to eighth place in the standings, in position to fight for a Europa League spot next season.
Betis stayed 13th, 10 above the relegation zone.
''It's bad luck,'' Betis captain Joaquin Sanchez Rodriguez said. ''We deserved at least a point after the match that we played.''