A second-half strike from Alexander Szymanowski secured a point for Leganes at Athletic Bilbao to secure survival in their first La Liga campaign.
Spain international Aritz Aduriz gave the Basque side a first-half lead, and along with Sporting Gijon winning at Eibar, this looked to be enough to send Lega into the final day with relegation fears.
The Polish-Argentine winger found himself on the end of a clever lobbed pass by Gabriel Pires and produced a cool finish to beat Kepa Arrizabalaga.
Along with Deportivo, the Butarque-based side have secured survival – a significant one due to this being their first season in Spain’s top flight, secured with seven points from their last four outings.
Athletic remain sixth and face Atletico Madrid away from home on the final day with their European qualification hopes hanging in the balance.