Antoine Griezmann scored an 84th-minute winner to move Atletico Madrid closer to the top three with a 1-0 victory at Granada at the Estadio Nuevo Los Carmenes.
The hosts looked set to cling on for a valuable point until Griezmann produced a superb diving header following a cross by Koke six minutes from time to grab the victory.
It was Griezmann's fourth goal in his last four matches.
To make matters worse for Granada they had Mubarak Wakaso sent off in injury time for an unnecessary foul on the Frenchman.
Atletico cut third-placed Sevilla's advantage to five points, with the top three teams automatically qualifying for the Champions League. The fourth-placed club has to go through a playoff.
Granada stayed in 18th place, inside the relegation zone and five points adrift of safety.