Real Sociedad qualified for the Champions League for the first time in a decade as their 1-0 win over Deportivo la Coruna combined with Valencia's 4-3 defeat away to Sevilla meant they claimed fourth place on a dramatic final evening of the La Liga season.
Defeat for Depor also ensured that the Galicians were relegated as Celta Vigo leapfrogged their rivals with a 1-0 win over Espanyol.
Celta's win meant that Mallorca's 4-2 victory over Valladolid was in vain as they too were relegated along with Real Zaragoza, who were beaten 3-1 at home by Atletico Madrid.
Valencia had gone into the final round of fixtures with a two-point lead over Sociedad and after a run of four consecutive victories they made the perfect start once more when Ever Banega put them in front after just 12 minutes at the Sanchez Pizjuan.
However, things started to turn against Los Che towards the end of the first-half as Alvaro Negredo scored twice in quick succession for the hosts and Jonas was also sent-off to leave Valencia down to 10 men.
Roberto Soldado briefly gave the visitors hope when he equalised 11 minutes into the second-half, but Negredo sent a clear message to Spain boss Vicente del Bosque, who had left him out of his squad for the Confederations Cup earlier in the week by scoring twice more to take his tally for the season to 31.
Soldado pulled another goal back at the death for Valencia, but it wasn't enough as they join Real Betis in qualifying for the Europa League.
Sevilla themselves could be Spain's third Europa League representatives despite finishing ninth as Malaga are currently banned for competing in European competition next season pending an appeal to the Court of Arbitration for Sport and Rayo Vallecano have also not been granted a UEFA licence by the Spanish Football Federation.
Valencia's defeat meant Sociedad just needed to win at the Riazor and Antoine Griezmann put the visitors in front after 22 minutes.
Carlos Vela then missed a great chance to double Sociedad's advantage and they had to withstand some intense pressure from Depor late on to secure their place at European football's top table.
Diego Salomao somehow headed over with an open goal to aim at 15 minutes from time before Abel Aguilar saw another headed effort clip the top of the bar moments later.
Sociedad also had to see out the final few minutes with just 10 men as Markel Bergara saw a second yellow card, but they held on to seal fourth spot.
Depor's defeat meant that victory for any of the three sides below them at the beginning of the evening would see them relegated and it was their Galician rivals Celta who took advantage as Natxo Insua's 16th-minute goal was enough to given them a 1-0 win over Espanyol.
That result meant that Mallorca's 4-2 win over Valladolid was meaningless, whilst Zaragoza conceded three times in the final six minutes to lose 3-1 to Atletico Madrid and finish bottom of the table.