Third tier Poli Ejido came from behind to clinch a 3-2 win at home to Espanyol in their King's Cup last-16 first leg on Wednesday.
Espanyol, struggling near the foot of the Primera Liga, took the lead with a Moises Hurtado header in the first half, but the Segunda B side hit back after the break.
Jorge Molina put away a penalty and then helped set up Juli for their second before Roman Martinez curled in a superb equaliser for the visitors.
The goal of the game came as Ejido's Chico lashed high into the top corner from 25-metres for the winner, with Espanyol's challenge fading after Moises picked up his second yellow card.
The other non-Primera Liga club left in the competition, Segunda B side Real Union, fell 1-0 at home to Real Betis.
Holders Valencia scraped a 1-1 draw away to Racing Santander, while Sevilla beat Deportivo Coruna 2-1.
Luis Fabiano and Frederic Kanoute got the Sevilla goals but they failed to make the most of their dominance and Omar Bravo's late strike gave Depor a lifeline for the return leg.
Kanoute was booked after scoring for lifting his shirt to reveal another shirt with "Palestine" written across it.
On Tuesday, a Lionel Messi hat-trick gave Barcelona a 3-1 away win over Atletico Madrid in the round's opening first leg.
The second legs are scheduled for next week.