Ether Gonzalez’s opener had the hosts heading for an early exit, but Ella Toone rescued the Lionesses six minutes from the end of normal time before Stanway’s winner took England into the last four of a fourth consecutive major tournament.
Sarina Wiegman’s side will face Sweden or Belgium in the last four on Tuesday. England were given a boost pre-match with the return of Wiegman to the touchline after she tested negative for coronavirus earlier in the day.
The Lionesses had everything their own way in the group stage as they plundered 14 goals without reply against Austria, Norway and Northern Ireland.
However, despite their own struggles to reach the knockout stages, Spain were a big step up in class. La Roja had been pre-tournament favourites before injuries to reigning Ballon d’Or winner Alexia Putellas and all-time top goalscorer Jennifer Hermoso rocked their preparation.