Leganes pulled off a 3-2 win against Real Betis on Saturday in the 38th and final round of La Liga.
Real Betis dominated the field for most of the game, with Joel Campbell opening the scoring in the 20th minute, while Leganes left back Diego Rico was sent off after two yellow cards in the first half.
However, Leganes central defender Dimitris Siovas equalized with a goal in the 28th minute.
In the second half, Leganes forward Jose Naranjo scored another goal in the 64th minute, but Real Betis again responded with a goal from Antonio Sanabria in the 76th minute.
Leganes managed to pull ahead thanks to a goal from Nordin Amrabat just three minutes later.
Real Betis is sixth in La Liga with 60 points, while Leganes trails far behind in 17th place with 43 points.