Goals from David Villa (two), Juan Mata and Joaquin did the damage for Los Che after Emiliano Moretti had gifted the visitors an early lead with an own goal.
A late strike from Angel Lafita then gave the scoreline a slightly flattering look for Deportivo.
The Brazilian striker’s curling first-half effort proved the difference between the two sides and allowed Sevilla to climb to fourth in the table.
Alvaro Negredo scored deep into injury time to give Almeria a last-gasp 1-0 victory over Recreativo Huelva.
The striker slotted home in the fourth minute of added time after Albert Crusat’s shot rebounded off a post, handing the hosts a much-needed win.
Getafe also claimed a dramatic late 1-0 win over Athletic Bilbao thanks to a stunning strike from midfielder Javier Casquero.
Casquero picked the ball up near the halfway line and pushed into Athletic’s half before lobbing Gorka Iraizoz from 30 yards with a superb left-footed chip to give Victor Munoz’s side their first win since the opening day of the season.
The midfielder was not the only hero for Getafe though, as goalkeeper Jacobo Sanz was in inspired form to shut out an Athletic team that dominated the game.
Pierre Webo’s late strike gave Mallorca an impressive 2-1 win at Racing Santander to move them up to 10th place after five games.
Ivan Marcano gave Racing the lead after 22 minutes, but Fernando Varela equalised for Mallorca on the stroke of half-time and Webo popped up with the winner four minutes from time.
Malaga finally bagged their first goals of the season to climb out of the bottom three with a 2-1 victory over Real Valladolid.
The home side had failed to score in 360 minutes of top-flight football since winning promotion last season, but broke their duck when Manuel Lolo put them ahead.
Adrian Lopez then doubled his side’s lead 10 minutes into the second half, although they were forced to endure a nervous end to the game when Pedro Leon pulled one back for the visitors in the 65th minute.
And Numancia and Osasuna shared the points in a lacklustre goalless draw at Los Pajaritos.
Neither side looked like scoring and Numancia finished the game with 10 men following the late dismissal of Juan Carlos Moreno.
The Argentine slotted home a penalty in what was by then the 13th minute of added time – the majority of which came about after flares were thrown by Barca fans into the Espanyol section.
That caused the players to be dragged to the side of the pitch by the referee for several minutes while numerous fans tried to escape the seating area by moving onto the running track surrounding the pitch at the Montjuic stadium.
At the time, Espanyol, down to 10 men after Nene was sent off, were leading 1-0 thanks to Ferran Coro’s first-half goal, but Barca turned things around after the interruption.
First Thierry Henry equalised and then Messi converted a contrroversially-awarded penalty.
The ref Luis Medina-Cantelejo pointed to the spot after Nicolas Pareja appeared to bring down Samuel Eto’o but replays showed he got a toe on the ball.
The protests were waved away and Messi kept his cool to send Carlos Kameni the wrong way and earn the points for the men from across town.
Real Madrid also relied on a stoppage-time strike – this one from from Ruud van Nistelrooy – to earn a dramatic 2-1 victory over Real Betis.
Another former Manchester United player, Gabriel Heinze, had given Madrid the lead but the visitors’ night turned bleak when Sergio Garcia equalised and Marcelo was sent off.
But Garcia was himself red-carded, after notching his first goal for the club, and Van Nistelrooy stole the points to ensure Madrid’s fourth successive win.
While there was drama involving the league’s big guns, it is Villarreal who stay on top of the Primera Liga after a 1-0 win over Sporting Gijon who remain bottom.
Giuseppe Rossi scored the only goal of the game after 64 minutes in a match which Sporting had largely dominated.
Croatian striker Mate Bilic hit the bar for the hosts before Rossi netted against the run of play, picking up a rebound in the area and firing clinically past Sporting keeper Ivan Cuellar from 12 yards.