Alcacer continued his rampant form by smashing the ball into the top corner in the eighth minute at the Principality Stadium, scoring for the fifth game in a row after netting seven times in his last four outings for Borussia Dortmund.
Defender Marc Bartra, who like Alcacer played under Enrique at Barca, got his first international goal with a header from a corner in the 74th, Spain's 12th strike under the new coach after beating Croatia 6-0 and England 2-1 in the Nations League.
Wales striker Sam Vokes got a consolation for Ryan Giggs' side in the 89th, heading a David Brooks cross beyond goalkeeper Kepa Arrizabalaga, who replaced David de Gea in the second half.
The home side's injury problems worsened when teenager Ethan Ampadu was forced off early in the second half.
Both sides are in Nations League action next week with Spain hosting England on Monday and Wales visiting Ireland on Tuesday.