Aritz Aduriz headed the home side into the lead shortly before the break, but the midfielder's fine finish and the striker's late winner booked a last four clash with Real Madrid.
The midfielder turned home a fine finish from 12 yards early in the second half after Aritz Aduriz had drawn the hosts level in the tie with a header shortly before the break.
Costa beat the offside trap in the closing minutes before rounding the keeper and slotting home to ensure the holders' place in the last four.
Atletico started the game brightly and had the chance to double its aggregate advantage with just a minute on the clock as Costa raced clear on goal, but his side-footed effort was tame and Iago Herrerin saved.
Filipe Luis had to be stretchered off a few minutes later, and as Atletico lost its early momentum, Athletic took control of the match.
Iker Muniain tried a half-volley from the edge of the area but fired straight at Thibaut Courtois before Mikel Rico fizzed a low shot just wide.
Athletic continued to pour forward but Atletico's defense looked likely to hold firm until the break - but the home side got the goal its play deserved.
Muniain slipped it wide to Mikel Balenziaga, and his teasing cross was met powerfully by Aduriz, whose header left Courtois with no chance.
Atletico had its Belgian keeper to thank for keeping the scores at 1-0 until the break, as he first pulled off a terrific double-save to deny Iraola and Aduriz before leaping to his left to claim Rico's effort.
Diego Simeone's side came charging out of the blocks in the second half and quickly restored its aggregate advantage, with Raul Garcia on hand to sweep home from close range following another good save from Herrerin.
Both goalkeepers were then called into action again, with Courtois denying Ander Herrera well after Athletic broke from Herrerin's save.
The high tempo of the first 50 minutes stuttered to a halt as Athletic lost its momentum, while Atletico set itself up to contain and counterattack efficiently in the pouring rain at the San Mames.
As Athletic continued to push forwards for an equalizer, the visitors took full advantage of a failed offside trap, allowing Costa to stroll clean through on goal and round Herrerin before slotting home.
Atletico will now face bitter rivals Real Madrid in the semifinal in a repeat of last season's final, with the first leg to be played next week.