The ever-lethal Roberto Soldado put Valencia ahead midway through the first half but Inigo Martinez's volleyed goal put Philippe Montanier's side back on level terms.
Goals from Chory Castro and Imanol Agirretxe late in the second half appeared to have sealed the win for the Basques, before Jonas pulled one back for Valencia just as injury time approached to set up a tense finish.
Agirretxe scored again to put the result beyond doubt and, with five games left, they have a five-point cushion over Valencia.
Malaga sit in between them and despite being banned from Europe, boosted their hopes of a top-four finish in the Primera Division with a narrow 2-1 victory over mid-table Getafe at La Rosaleda.
Goals either side of half-time by Roque Santa Cruz and Weligton put the hosts in control, before Juan Valera grabbed a consolation for Getafe with 15 minutes left.
Malaga - banned from the continent for next season over unpaid bills - headed into the game on the back of last weekend's thumping 5-1 defeat at Valencia but shrugged that off to take the points.
Sevilla look consigned to a mid-table finish after playing out a 1-1 draw at Valladolid.
Unai Emery's men went into the game knowing a win could have left them with an outside but fighting chance of making Europe next season.
But they left Jose Zorrilla with a point that leaves them off the pace - Alvaro Negredo's second-half penalty getting them a share of the spoils after Javi Guerra's opener.
At the bottom end of the table, Granada pulled themselves clear of the relegation zone after holding out for a narrow victory, 1-0 at Espanyol.
A superb free-kick by Nolito was enough to see off Javier Aguirre's side, who were the better team throughout the match but were unable to take their chances.