The Shakhtar-Sevilla clash was played in the western Ukrainian city of Lviv because of the political and military unrest around Donetsk in eastern Ukraine.
Spain midfielder Vitolo put Sevilla ahead against Shakhtar after just six minutes with a low drive after being cleverly set up by Kevin Gameiro.
However, the 2015 and 2014 winners failed to build on their early lead and allowed Shakhtar to take control.
Marlos quickly levelled for lively Shakhtar after taking a pass from Yaroslav Rakitskiy, then Taras Stepanenko gave them the lead by heading in a centre from the impressive Marlos.
Sevilla dominated the second half and Kevin Gameiro made it 2-2 eight minutes from time with a calm penalty, after Vitolo had been clumsily pulled down in the box by Facundo Ferreyra.
Meanwhile in Villarreal, Liverpool’s Joe Allen almost gave the visitors an early lead, only to be foiled by local keeper Sergio Asenjo.
Villarreal dominated for the next hour, with Cedric Bakambu heading a corner against the Liverpool post.
Liverpool’s Roberto Firmino hit Asenjo’s post with a powerful drive, as Liverpool finally came out of their shell in search of what would have been an important away goal.
However, the visitors were caught by a slick sucker-punch right at the end as the hosts snatched a late win, when Denis Suarez launched a quick break and unselfishly set up supersub Adrian Lopez to make it 1-0.
The second legs will be played in Sevilla and Liverpool May 5.