Espanyol have defeated Real Sociedad 3-2 in La Liga after Hernan Perez struck a 91st-minute winner.
Real Sociedad dominated the early stages of the match, and Aritz Elustondo headed wide of the right post from a corner after three minutes.
Carlos Vela then had a chance when he picked up Sergio Canales's through ball, but the forward could not hit the target.
Imanol Aggirretxe broke the deadlock in the 20th minute with a close-range finish after Alberto de la Bella's assist.
Espanyol had a number of chances to equalise before half time. First, Victor Alvarez missed the target from long range before Enzo Roco and Gerard had shots blocked.
They did grab an equaliser in the 42nd minute, when Geronimo Rulli fouled Marco Asensio in the penalty area.
Rulli was dismissed as the last man and Gerard despatched the spot kick to level the scores.
Ten-man Sociedad came out strongly after the half-time break. Shots from Elustondo and Agirretze went off target.
On the hour mark, Gerard, looking for his second of the night, forced substitute goalkeeper Oier into a save with a long-range shot.
Espanyol took the lead in the 71st minute. when Roco headed into the top left corner from Hernan Perez's corner.
Burgui's attempt to double the lead was stopped by Oier and Victor Sanchez missed the target with 10 minutes remaining.
Jonathas scored the equaliser with just three minutes remaining when he connected with Gonzalo Castro's cross to hit the back of the net.
Just as the match looked like it was going to finish as a draw, Perez headed into the bottom right corner from Alvaro Gonzalez's corner.