The home side edged ahead 3-2 with Diego Llorente's header in the 76th minute off a Sandro free kick.