The man who scored the winning goal in the 2013 Copa del Rey final produced another towering header to break the deadlock before the Rojiblancos' top scorer netted a penaltyAtletico Madrid beat plucky Elche 2-0 to go six points clear at the top of La Liga on Friday.
Brazilian defender Miranda grabbed his second goal of the season in the Spanish top flight 18 minutes from time, after David Villa had failed to convert a second-half penalty.
Costa, who missed a penalty at Getafe last weekend, then secured the points with his 35th goal of the season from the spot, after Cristian Sapunaru had brought him down - and received a second yellow card - in added time.
Diego Simeone's side had been frustrated by relegation-threatened Elche at a packed Vicente Calderon before Miranda and Costa secured an eighth consecutive La Liga victory.
With Barcelona not playing until Sunday and Real Madrid out of action this weekend, Atleti now have an ominous advantage at the summit with four games remaining as they attempt to win their first La Liga title since 1996.
They can head into Tuesday's Champions League semi-final first leg against Chelsea knowing they are in with a great chance of securing a famous double. Defeat for Elche, on the other hand, keeps them only four points above the relegation zone.
Costa suffered a leg wound in a collision with a post in the victory at Getafe last weekend, but the striker was passed fit to start.
And the Spain international was soon in the thick of the action when he fired into the side-netting after Adrian Lopez laid the ball off to him five minutes in.
Elche were not content to just make up the numbers, though, and Thibaut Courtois produced a fine save to keep out a left-footed strike from Javi Marquez before then having to be alert to thwart Damian Suarez when the defender was allowed a free header from the resulting corner.
Filipe Luis fluffed his lines at the other end when the ball fell kindly for him in the penalty area before the home side were given another scare just before the half-hour mark, as Carles Gil fired over the crossbar from inside the area.
Atleti were not at their best in the first half, but ought to have been in front four minutes before the break when Costa flicked on Juanfran's cross and David Villa prodded wide with the goal gaping. Villa had appeared to be in an offside position, but the flag failed to go up.
Simeone replaced Adrian with Raul Garcia at the break and the substitute took only four minutes to make an impact, as Sapunaru was adjudged to have bundled him over in the area and Carlos Clos Gomez pointed to the spot.
Villa stepped up to take the resulting penalty after Costa's miss against Getafe, but the former Barcelona man also failed from the spot as Manu Herrera kept out a tame effort diving to his left.
There was more frustration for Villa when he had a goal ruled out for offside and was then substituted to ensure Elche remain the only current top-flight team he has failed to score against.
Costa was booked following his reaction to two strong challenges, which sparked a melee that also saw Alberto Rivera go into the book.
An animated Simeone orchestrated the Atleti faithful and the opening goal they craved eventually arrived when Miranda rose highest to head home Jose Sosa's corner in emphatic fashion.
Costa then raced clear and was denied by Herrera, but made no mistake when he sent the keeper the wrong way from the spot after Sapunaru had upended him in the 90th minute. The defender was shown a second yellow card to compound his misery.