Real, for their part, had defender Pepe dispatched for an early bath.Cristiano Ronaldo gave the whites the lead with a disputed penalty, while Gonzalo Higuain and Karim Benzema changed the jeers to cheers in the Estadio Bernabeu with handsome late goals.
As usual, Jose Mourinho's side did not entertain the fans and there were boos and whistles from some quarters before the happy ending.Higuain said that "the important thing is that we have won again, for the third consecutive time."
The Argentine striker conceded that "we did not really play entertaining football for most of the game, and the fans have the right to react in whatever way they feel is appropriate".
Real now have 10 points from four matches. Valencia - the only team to have won their first three matches - will regain top spot if they beat Atletico Madrid at home Wednesday.
A horrible pitch in the Bernabeu did not make good football easy. The hosts made a dull start but the game exploded in the 28th minute when the whites were given a controversial penalty for a possible handball by Luis Garcia.
Cristiano Ronaldo converted the penalty but had to take it again as he had stopped in his run-up the first time. He converted the second time for his first goal of the season.
On the hour, Pepe picked up a second yellow card for holding Jose Callejon. Just three minutes later, Espanyol defender Ernesto Galan got a harsh direct red card for a foul on Ronaldo.
Even so, the visitors forced several sharp saves out of Iker Casillas, who has been Real's player of the season so far.
In the 79th minute, Higuain made it 2-0 after Ronaldo had cleverly mounted a fast break. Espanyol then lost their discipline and Juan Forlin was sent off for dissent.Benzema - keen to show Mourinho that he deserves a place in the starting lineup - took advantage of the disorder to come off the bench and make it 3-0.
Earlier Tuesday, Athletic Bilbao had moved up to joint third with a comfortable 3-0 home defeat of dull Mallorca.
The islanders almost made it intact to half-time in old San Mames, but David Lopez made it 1-0 in a bizarre fashion just one minute before the interval.Lopez centred from the right with his left foot and the cross deceived the Mallorca defenders and keeper Dudu Aouate - and went in at the far post.
In the 62nd minute, the hosts were given a penalty when a header from World Cup striker Fernando Llorente hit defender Jose Carlos Nunes on the hand. Mikel San Jose calmly made it 2-0 from the spot, and Mallorca were finished.
The third goal came two minutes into injury time and was scored by supersub Inigo Perez, after a Llorente shot had been blocked by the luckless Nunes.
Llorente said, "The fans were really great tonight. We have made a good start this season, but we should not get too excited now because there is still a very long way to go."Bilbao have seven points from four games, two fewer than Valencia and three fewer than Real.
Defending champions Barcelona, who are seventh, are at home to Sporting Gijon Wednesday - without injury victim Lionel Messi.
Also Tuesday, Osasuna scored their first win by coming from behind to beat Real Sociedad 3-1, with goals from Walter Pandiani, Javier Camunas and Carlos Aranda.
Former Spain striker Raul Tamudo had given Sociedad an early lead, but their defence was soon to collapse at the other end.
The encouraging win will relieve the pressure on Osasuna coach Jose Antonio Camacho, as his team now moves up to 10th.