Elche have been confirmed for the Primera Division for next season after victory at Malaga.
Jonathas de Jesus scored his 12th goal of the season to give the visitors a first-half lead but Malaga, who had three goals disallowed over the 90 minutes, should have levelled in the second half when they were awarded a penalty and Elche goalkeeper Przemyslaw Tyton was sent off for bringing down Javi Guerra.
However, Duda hit the woodwork from the spot and then Chelsea loanee Mario Pasalic sealed the points by finishing off a smooth counterattack.
Javi Guerra pulled one back in the 94th minute and could have even grabbed an equaliser in the final minute of stoppage time, but Elche held on to jubilantly celebrate securing top flight status for a second year in a row.