Real Madrid s Eder Militao, left, celebrates with his teammate Rodrygo after he scored his side s second goalduring a Spanish La Liga soccer match between Real Madrid and Espanyol at the Santiago Bernabeu stadium in Madrid, Spain, Saturday, March 11, 2023. AP
Joselu had sent the visitors ahead early on at the Santiago Bernabeu but Vinicius produced a surging run and lethal finish to pull the champions level.
Eder Militao's header completed the turnaround and Madrid could have added more goals in the second half, with Rodrygo hitting the crossbar from a free-kick.
Eventually Marco Asensio tucked away the third in stoppage time after a fine run and pass from defender Nacho Fernandez.
Barcelona visit Athletic Bilbao on Sunday night to try and restore their advantage, ahead of the Clasico at Camp Nou on March 19.
With Karim Benzema out with an ankle issue, although poised to return for the Champions League last 16 second leg clash with Liverpool on Wednesday, Carlo Ancelotti selected Rodrygo up front in his place.
The coach also opted to play Eduardo Camavinga out of position at left-back again and the French midfielder's mistake helped the visitors move ahead after eight minutes.
Camavinga misjudged a long ball which he allowed to reach Ruben Sanchez, who crossed for striker Joselu to smash into the top corner.
Stirred by Espanyol's goal, Madrid quickly improved in the early afternoon spring sun, and Vinicius fired them level with a superb solo effort of his own.
The Brazilian winger cut inside from the left and drove home to net his 19th goal of the season across all competitions.
Militao headed the champions in front before the break, meeting a sumptuous Aurelien Tchouameni cross, which the midfielder served up with the outside of his boot.
Vinicius blasted over as Madrid looked to press home their advantage and the Brazilian was also knocked to the floor off the ball by Oscar Gil, who was booked.
The forward has been targeted by opposition defenders in recent months and Vinicius appeared winded after Gil's bodycheck.
Rodrygo came closest to extending Madrid's lead when he curled a free-kick over the wall but it struck the crossbar.
Espanyol could not trouble Thibaut Courtois in the final stages, with Martin Braithwaite directing a header a long way off target.
Vinicius was warmly applauded by Madrid fans as he was taken off late on, with Ancelotti giving another brief cameo to young forward Alvaro Rodriguez.
However it was another substitute, Asensio, who wrapped up the win with a cool finish after Nacho's uncharacteristic dribble forward into attack.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)