Pablo Osvaldo struck the winner as Espanyol strengthened their hold on fourth place in the Primera Division with victory at Atletico Madrid.
The visitors twice surrendered the lead but still kept pressing and Osvaldo's goal in the 78th minute put them two points behind Villarreal.
Luis Garcia put the Catalans ahead with a 22nd minute penalty only for Tiago to bundle in an equaliser on the stroke of half-time.
Sergio Aguero brought the hosts level again after Joan Verdu had restored Espanyol's lead, but they could not keep the visitors out and frustrations boiled over in the closing stages as boss Quique Sanchez Flores appeared to be sent to the stands for trying to drag Javi Marquez to his feet after he had been fouled.
Much of Espanyol's success so far has come at home but on their travels the Catalan outfit have been much less convincing, picking up just four points and one goal in six games.
Atletico also boast a good home record with four wins and they climbed to sixth with victory at Real Sociedad last week.
They almost got off to the best possible start. A long-range shot by Diego Forlan was fumbled by Carlos Kameni before Tomas Ujfalusi drew a parry from the keeper.
However, Osvaldo should have given Espanyol the lead when he got ahead of Luis Perea but the striker chose to try and place his header into the near post rather than going across the keeper and the ball went well wide.
The visitors were soon ahead courtesy of a hotly-disputed penalty as Jose Antonio Reyes was penalised for handball when he put both his arms in front of his chest to repel Jose Maria Callejon's free-kick.
The former Arsenal player was booked and Luis Garcia made no mistake with his spot-kick, hitting an unstoppable penalty into the roof of the net.
The hosts hit back and Kameni had to get down smartly to stop Simao's shot from creeping in and the same player should have equalised 10 minutes before the break.
Reyes pulled the ball across the face of the goal from the right with Kameni clawing it away only for Simao to pounce but he blazed wide when faced with an open goal.
The hosts continued to press and in first-half injury time they drew level through Tiago despite Kameni's best efforts.
Reyes took a corner from the right which Tiago headed goalwards to be blocked by Kameni's chest, Diego Godin pounced and shot but the keeper parried the shot only for the former to slam the ball home high into the net.
Both sides came out attacking in the second half with Simao a constant threat for Atletico and he almost put them ahead when he was played in by Reyes only for Kameni to block his close-range shot with his legs.
Espanyol regained the lead against the run of play in the 54th minute through Verdu.
Osvaldo did most of the work, shoulder-barging Perea as both chased the ball before turning and tucking inside and releasing a shot David De Gea could not hold on to and Verdu came in quicker than anyone else to slot the ball home.
There were loud appeals for a penalty from the hosts when Aguero went down in the area but a goal kick was awarded.
De Gea saved with his legs from Verdu but it was Atletico who scored the next goal as Aguero slotted home from Diego Forlan's incisive through ball with 25 minutes left.
But Espanyol took the lead for the third time in the 78th minute when Osvaldo volleyed in from Luis Garcia's right-wing cross.
Aguero should have equalised but shot tamely into the side netting when through on goal.
And Atletico boss Sanchez Flores lost his cool in stoppage time when he tried to pull Javi Marquez to his feet after the Espanyol man had gone down under a hefty challenge from Godin. Sanchez Flores appeared to watch the closing moments of his side's defeat from the stands.