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.
Ten-man Villarreal slumped to a 2-0 home defeat to Getafe Thursday night.
Ciprian Marica's early goal got Getafe off to the ideal start and their cause was further helped by a 39th-minute red card for defender Pablo Iniguez for a foul on Marica.
The Yellow Submarine regrouped and had chances to get back on level terms, but they were finally sunk two minutes into injury time when substitute Pablo Sarabia added a second.
The win moved Getafe, who have now won five of their last six in the league, to within a point of their opponents.
Athletic Bilbao hit back from 2-0 down to salvage a point at home to Elche to remain fifth in the table.
Elche, who have recovered from a tough start to win three of their last four games, looked to be on course for another victory as they forged ahead thanks to goals from David Lomban and Aaron early in each half.
But the home side responded well and cut the deficit through Markel Susaeta (55)before Aritz Aduriz (69) restored parity just two minutes after being thrust into the fray.
Real Betis held on for a point from their clash with Levante despite playing the final hour of the match with only 10 men following the first-half dismissal of defender Javier Chica, who was booked twice in the opening 30 minutes.