Deportivo La Coruna came back from 2-0 down away at champions Barcelona to spoil a homage to Xavi Hernandez at the Camp Nou and stay up with a 2-2 draw along with Granada who held Atletico Madrid 0-0 at home.
That point was enough to ensure Atletico go straight into next season's Champions League group stages in third, while Valencia twice came from behind to win 3-2 at Almeria and secure fourth.
Eibar's remarkable first season in the top flight didn't have fairy tale ending as they were relegated despite just a second win in 20 matches 3-0 at home to Cordoba due to their inferior head-to-head record with Deportivo and Granada.
Athletic Bilbao also secured European football for next season in the Europa League thanks to a 4-0 thrashing of Villarreal.