Villa’s brace in the final 20 minutes – the second coming in stoppage time shortly after a straight red card for Malaga substitute Salva Ballesta – was enough to see off a spirited challenge by the Andalusians at La Rosaleda.
The Spain striker will be grateful for Mata’s part in providing both chances when it seemed a glaring first-half miss might prove costly. Villa sliced over the bar with the goal at his mercy after quarter-of-an-hour.
Elsewhere, Almeria’s unbeaten start to the season came to an end as the Andalusian side came unstuck in losing 2-0 to spirited Real Valladolid.
Alvaro Rubio struck the opener midway through the second half and Haris Medunjanin added a second in stoppage time to give Valladolid their second home success of the campaign.
Rubio was later sent off following a second yellow card in the closing stages, and the game saw more controversy as Almeria were erroneously denied an equaliser by the assistant referee’s flag shortly after Valladolid went ahead.
Real Mallorca recorded their first win of the new Primera Liga season after scoring early in each half to see off Numancia 2-0 at the Ono Estadi.
Mallorca had finished last season with six successive victories but they had to wait until round four of this campaign to finally get off the mark, Jose Manuel Jurado and Pierre Webo with the goals.
Athletic Bilbao came from a goal down to salvage a point and continue their recent resurgence with a 1-1 draw at Recreativo Huelva.
The opening hour of play was tense, but the game sprang to life in the closing stages and Javi Guerrero gave Recreativo the lead after 71 minutes.
But Athletic hit back just four minutes later through David Lopez and held on for a valuable point to extend their unbeaten run to three games.