After a first half of few chances, Cedric Bakambu's header clipped the Reds upright shortly after the break.
Liverpool went closest when Roberto Firmino's low shot hit the post.
The Reds looked set for a creditable draw in Spain until they switched off to allow substitute Adrian Lopez to tap in Denis Suarez's low cross.
Despite the dramatic winner, the Europa League semi-final still remains delicately poised before next Thursday's return leg at Anfield.