The White and Blues were on course to secure a huge three points in their battle against the drop, with goals from Cesar Montes and Martin Braithwaite either side of the half-time interval sending them 2-1 ahead.
However, Samuel Lino's leveller in the 93rd minute relegated Espanyol, with Luis Garcia's side on 36 points from 37 matches, four behind 17th-placed Celta Vigo with only one game left.
Espanyol have joined Elche in being relegated to the Segunda Division, but the third spot is still open heading into the final matchday, with Real Valladolid in 18th, one point behind 17th-placed Celta.
Cadiz, Getafe, Valencia and Almeria are also in danger of finishing in 18th ahead of what is set to be a fascinating final set of fixtures in Spain's top flight.
Espanyol's relegation from La Liga in 2019-20 came as a huge surprise, but they won the Segunda Division the following campaign and will be bidding to return at the first time of asking next term.
Real Sociedad, meanwhile, secured fourth position in the table on Sunday despite suffering a 2-1 defeat at third-placed Atletico Madrid.
Villarreal would have stayed in the race had they managed to beat Rayo Vallecano, but the Yellow Submarine suffered a 2-1 defeat, so Real Sociedad have claimed a top-four spot for the first time in 10 years.
Champions Barcelona returned to winning ways following back-to-back losses, recording a 3-0 win over Mallorca, while Villarreal and Real Betis have been confirmed in fifth and sixth respectively, securing qualification for next season's Europa League group stage.
Seventh position, and a spot in the playoff round of the Europa Conference League, is still open, though, with Copa del Rey finalists Osasuna currently in charge of the final European place.
Athletic Bilbao are level on points with Osasuna, though, while Girona, Rayo and Sevilla are all just one point behind seventh position ahead of the final set of fixtures.