Atletico Madrid are again in second place after victory over Granada.
Costa converted from the spot seven minutes before half-time after Diego Mainz had clattered into the back of Villa.
The former Barcelona striker also won the second penalty and this time took the spot-kick himself, sending Granada goalkeeper Roberto the wrong way.
The hosts were allowed back into the game when Atleti full-back Filipe Luis was sent off in the closing minutes, and Odion Ighalo got a goal back in the first minute of injury time to set up a tense finish for Los Rojiblancos, but in the end they held on.
For the big stories and the banter follow us on Twitter: @tribalfootball