Guilherme Siqueira's 89th-minute penalty was enough to secure Granada a deserved 1-0 win over Racing Santander in the Primera Division.
The visitors had by far the best of the opening period but failed to make the breakthrough as Odion Ighalo hit the post and Mario Fernandez made smart saves to deny Abel Gomez and Dani Benitez.
Racing improved after the break but still failed to provide any threat in the final third and were finally undone when Bernardo upended Ikechukwu Uche in the final minute and Siqueira calmly sent Mario the wrong way from the spot to ensure Granada move nine points clear of their opponents in the fight for survival.
Five defeats in their previous six games had kept Granada within touching distance of the bottom three, but Racing themselves had picked up only two points in that time and their lack of confidence was more obvious in a first period dominated by the away side.
Abel Resino had taken the decision to pair Ighalo and Uche in attack and they nearly combined for the opener on 13 minutes as Uche sent his compatriot through on goal but his shot across Mario came back off the post.
Ighalo had another shot well saved by Mario moments later and Gomez was next to be denied as his effort from the edge of the area was parried to safety by the keeper.
It took the hosts over half an hour to have their first effort on goal but Christian Stuani was not far away with a header from Domingo Cisma's cross.
Benitez was next to threaten as his rasping free-kick was saved at the second attempt by Mario five minutes before half-time, but it was Racing who were first to threaten after the break as Marc Torrejon's header from Edu Bedia's corner drifted just past the post.
However, the game seemed destined to end in a draw as both sides appeared devoid of ideas in the final quarter until Uche escaped the attentions of Bernardo and was brought down by the Argentinian as he entered the area.
The defender was lucky to be shown just a yellow card but that was of little consolation as Siqueira slotted away the penalty with ease.
Uche should have doubled Granada's advantage in stoppage time but after rounding Mario his effort lacked power and was cleared off the line.