Capdevila free-kick gets Villarreal in gear
Capdevila's Spain team mate David Villa netted his seventh of the season and Pablo Hernandez scored with a superb lob as Valencia climbed to fourth with a 3-0 victory at Almeria, who had goalkeeper Diego Alves sent off in the 63rd minute.
Ernesto Valverde's Villarreal side took the lead at the Madrigal in the 27th minute when striker Nilmar slid in at the far post to clip Damian Escudero's low cross high into the net.
Albert Luque equalised in first-half added time with a powerful downward header before Capdevila curled a left-foot strike around the wall into the bottom corner of the net just before the hour.
"When things are going badly you look for reasons why and today we came out very focused with a lot of commitment," Valverde told a news conference.
"It cost us a lot of effort and you always hope that when you win a match it's the start of a good run."
Villarreal are now 18th with six points from eight matches while Malaga have taken over as the bottom side on four.
A depleted Real Madrid side were held to a 0-0 draw at Sporting Gijon on Saturday.
Real have 19 points from eight matches and top the standings ahead of Barca on goal difference.
Valencia took the lead at Almeria's Juegos Mediterraneos stadium in the 54th minute when winger Hernandez raced clear and crossed for Villa to nod past Alves.
Alves was shown a straight red card after he chopped Hernandez down outside his area and Hernandez then caught his replacement, Esteban, off his line with a perfectly weighted lob from distance to double Valencia's lead.
Juan Mata made sure of the points with a well-struck shot three minutes from the end of normal time.
Deportivo Coruna missed a chance to climb above Sevilla into third when they were thumped 4-0 at Real Valladolid earlier on Sunday, and Athletic Bilbao lost 2-0 at Getafe.
Osasuna conceded a goal in added time to draw 1-1 at Racing Santander while Tenerife beat fellow promoted side Xerez 1-0.