Atleti looked destined to hold on for at most a draw after Mario Hermoso was shown a straight red card for a foul on Loren Moron, but substitute Costa steered home Yannick Carrasco's free-kick in the 74th minute to secure a top-four finish for Diego Simeone's men.
After seeing goals for Angel Correa and Alvaro Morata overturned by VAR, there were concerns Costa's header would be ruled out during a lengthy check for handball.
However, the goal was allowed to stand, ensuring Atleti will return to European football's top table in 2020-21.
Correa slammed home a volley midway through the first half, but after a trip to the pitchside monitor, referee Jose Luis Gonzalez Gonzalez ruled it out for a handball by Marcos Llorente in the build-up.
Andres Guardado drilled a low effort just outside the upright before Morata dinked a wonderful finish over Dani Martin but was deemed offside following a lengthy VAR review.
Atletico lost Kieran Trippier to an injury before half-time and would have fallen behind had Loren hit the target with his chip over Jan Oblak following a fortuitous bounce of the ball.
Simeone sent on Carrasco, Vitolo and Costa to begin a push for a winner but he was forced to make a defensive change – Felipe replacing Correa – after Hermoso was given his marching orders in the 57th minute.
Betis, playing for the first time since it was announced Manuel Pellegrini will be their new head coach next season, pushed for a winner but Atleti held firm.
Simeone's side then snatched all three points when Costa guided Carrasco's free-kick delivery into the bottom-right corner.
What does it mean? Time for rotation
Although Atletico have won just two of their past four matches, they are now unbeaten in nine since LaLiga resumed in June.
With Atleti out of reach, Simeone can start to consider resting players ahead of their Champions League quarter-final against RB Leipzig next month.
Costa makes the difference
Simeone has been using Llorente up front because he does not think Costa and Morata make a good pairing, but the Brazil-born Spain international staked his claim for more minutes with an important goal.
Bartra to blame
Three points were there for the taking for Betis, but Bartra was too deep when Carrasco swung in his free-kick and Costa took full advantage to net the winner.