After Dani Carvajal equalized for Madrid, Vinicius seized control of the game, scoring a crucial goal. Kylian Mbappe then sealed the victory with a late penalty, extending his scoring streak to four games for the club.
Hansi Flick's Barcelona, boasting a perfect record of five wins from five matches, visit unbeaten Villarreal, fourth, on Sunday, looking to restore their four-point lead.
"I thought it was a good game, (the players) reacted well after Espanyol's goal, we played much better, having more chances and I am happy," Ancelotti told reporters.
Madrid have not been at their most fluent but this was a cut above their recent displays and the Italian was impressed.
"We played much faster, touching the ball quicker up front, with some better movement," noted Ancelotti.
"Mobility is a very important weapon... bit by bit we're returning to our best version."
Advertisement
The comprehensive victory was Madrid's 38th consecutive La Liga game without defeat, their last loss in the competition coming just under a year ago, against Atletico Madrid in September 2023.
"That says a lot, not losing games in so many weeks is really nice, but we have to continue," said Madrid captain Luka Modric.
"It's quality, character, commitment from the team, everyone is ready when called on... those are the key factors."
Madrid had a stranglehold on the first half without being able to make the breakthrough, with Mbappe heavily involved, hunting for his sixth goal of the season across all competitions.
Advertisement
Espanyol goalkeeper Joan Garcia made a fine save at his near post to thwart the France captain's effort from a tight angle, among other stops.
Increasingly frustrated, Mbappe was booked for protesting against a decision called against him.
Madrid have been able to score just one first half goal in eight matches this season but on this occasion they were racking up the chances.
Carlos Romero came close for the promoted visitors early in the second period with a strike that flew off-target, but it was mostly one-way traffic in the other direction.
Madrid were therefore stunned when the visitors took the lead in the 54th minute, with Courtois clumsily deflecting Jofre Carreras' cross into his own net.
Stylish comeback
Ancelotti sent on Vinicius immediately but it was Carvajal who levelled four minutes later, tapping home on the line after Bellingham's cross squirmed away from the previously flawless Garcia.
Espanyol's resistance crumbled and Vinicius produced a sublime cross with the outside of his boot to tee up Rodrygo for the second.
Mbappe unselfishly slipped Vinicius through on goal to tuck home the third and the former Paris-Saint Germain star dispatched a late penalty himself to complete a sizeable victory.
It was Mbappe's fourth La Liga goal of the season, pulling him level with Barcelona's Robert Lewandowski as top scorer.
Endrick won the spot-kick as he exploded into the box and was dragged down by Romero.
Ancelotti said he had to be "unfair" to the 18-year-old Brazil striker, who is yet to start for the club.
"On one hand it's unfair because he's training very well, but on the other it's that we have Rodrygo, Mbappe and Vinicius up front, you have to be a bit patient," he said.
Elsewhere Valencia earned their first win of the season with a 2-0 victory over Girona, 13th, on Saturday.
Listen to the latest songs, only on JioSaavn.com
The Catalan side have now suffered three consecutive defeats, including a 1-0 loss at PSG in their Champions League debut on Wednesday.
(Except for the headline, this story has not been edited by staff and is published from a syndicated feed.)