There was finally a shift at the top of La Liga as Atletico Madrid thrashed Real Sociedad to go top, while Barcelona were beaten by Valencia. Real Madrid were held to a draw by Athletic Bilbao and remain third.

Atletico Madrid went top of La Liga for the first time since 1996 after an impressive 4-0 victory against Real Sociedad at the Vicente Calderon. Atleti dominated the first half as David Villa turned in a cut-back from Diego Costa to break the deadlock. It was the third goal in as many Primera games for Spain’s all-time top scorer, but he was substituted only a few minutes later with a thigh injury. La Real had the hosts under pressure after the break, but Diego Simeone’s side were lifted by the appearance of Diego Ribas from the bench, playing his first game since re-signing for the club on loan.

Diego Costa ran onto a through ball from Raul Garcia on the break and slotted into the bottom corner for the vital second goal and then Miranda powered in a header from a Koke cross to make it three. Three minutes from time, Ribas marked his return by shooting high into the net to cap a sensational night for Los Rojiblancos.

Ten-man Barcelona suffered their first home defeat of the season as Jordi Alba was sent off in a 3-2 loss to Valencia at Camp Nou. With Atletico Madrid winning, the result meant Barca were toppled from pole position in La Liga for the first time in 59 weeks. It looked to be business as usual when top scorer Alexis Sanchez gave Barca the lead in the seventh minute with his 13th goal of the season, but the Catalans let the game slip and went behind to goals from Dani Parejo and Pablo Piatti either side of half-time.

Lionel Messi responded quickly after the break by drawing La Blaugrana level from the penalty spot after Valencia skipper Ricardo Costa was adjudged to have handled, but Paco Alcacer scored a third for Los Che on 59 minutes and this time Barcelona had no answer. Dani Alves came close to scoring a late equaliser, but Jordi Alba capped a poor display at left-back by making things even harder for Tata Martino’s men when he was shown a second yellow card with 13 minutes remaining. The defeat was Barcelona’s first at Camp Nou since they lost to Real Madrid in 2012.

Cristiano Ronaldo was controversially sent off as 10-man Real Madrid were held to a 1-1 draw at Athletic Bilbao at San Mames. The world player of the year was red carded for reacting to a shove by Carlos Gurpegi and immediately confronting Ander Iturraspe in the 75th minute, although the decision to expel the Portuguese appeared harsh. Only a minute earlier, Athletic had scored a stunning equaliser, substitute Ibai Gomez scoring with only his second touch after coming on, firing in a bouncing ball from the edge of the area.

Carlo Ancelotti’s side had gone ahead on 65 minutes through striker Jese, making his first start in La Liga, but were left hanging on for a point. Los Blancos’ failure to take all three points left them behind Barcelona, but only on goal difference, any they now face the prospect of being without the suspended Ronaldo, possibly for three games.

Villarreal defeated Osasuna 3-1 at El Madrigal to remain fifth, three points behind Athletic, and leave their opponents hovering close to the relegation zone. Villarreal came out to attack after a goalless first half and Jeremy Perbet put them ahead immediately following the restart. Manuel Trigueros double the lead and Perbet hit his second with 15 minutes remaining. Oriol Riera grabbed a late consolation for the visitors but Villarreal ran out deserved winners.

Portuguese playmaker Duda scored twice as Malaga came from behind after throwing away the lead to defeat Sevilla 3-2 in an exciting Andalusian derby at La Rosaleda. Jose Antonio Reyes had a chance to put Sevilla in front in the 14th minute of an end-to-end encounter, but his shot was blocked by Willy Caballero. Instead, Duda put Malaga ahead after half-an-hour, slotting a penalty low into the right corner after he had been fouled by Coke.

Carlos Bacca levelled for Sevilla in the 49th minute, finishing into the bottom corner from the left of the area, before Fazio put the visitors in front, Ivan Rakitic swinging in a free-kick and the centre-back meeting it with his head to make it 2-1 in the 66th minute. There were more twists to come as Samu slammed an equaliser into the top corner following a cross from Pablo Perez and Duda completed the comeback, finishing from close range in the 83rd minute after being put through by Perez.

Rayo Vallecano avoided defeat for the first time in three league games by drawing 0-0 at Levante, but remained in deep trouble in the Primera Division relegation zone, six points from safety. It was an evenly matched game at the Ciutat de Valencia that saw few chances until a frantic final 10 minutes, but neither team were able to take any of the opportunities that fell to them.

Getafe went into their game against Real Valladolid at the Coliseum Alfonso Perez needing a win after six defeats and a draw in their last seven competitive matches had seen them slide down La Liga and crash out of the Copa del Rey. Diego Castro came close to stealing the points for the home side in stoppage time, but his thunderous 25-yard strike crashed against the post. The draw left Getafe in mid-table while Valladolid remain in trouble in the bottom three.

Celta Vigo continued their recent revival with a 2-1 win at Granada. Gustavo Cabral’s 28th-minute opener for the Galicians was cancelled out by Youssef El Arabi just before the break but the home side were denied a point as Augusto Fernandez netted the decider two minutes from time. Celta’s win was their third in four league games, lifting them up to 11th place, one place and three points above Granada, who have now lost four of their last six.

Elche moved four points clear of the Primera Division relegation zone after earning a narrow but deserved win at home to Almeria as both clubs look to avoid an immediate return to La Segunda. A somewhat lucky goal from Cristian Herrera, who deflected a shot from Javi Marquez past Esteban after 59 minutes, was enough for Fran Escriba’s side to take all three points, despite having Damian Suarez sent off in the 90th minute for picking up two yellow cards. The result means Almeria are just two points above the drop zone, while the men from Alicante side move up to 15th.

Real Betis registered only their third win of the season and their first since September as they overcame Espanyol 2-0 at the Benito Villamarin, but remain rooted to the foot of La Liga, eight points from safety. A second-half brace from Ruben Castro secured the points to give Gabriel Calderon his first win in charge of the Sevilla outfit. The striker has now scored Betis’ last four goals. Espanyol had their chances, but failed to test former Real Madrid goalkeeper Adan who was making his debut for Los Verdiblancos.