The tournament hosts looked in trouble trailing to Esther Gonzalez’s 54th-minute goal before Ella Toone drew things level with a smart finish with six minutes of normal time remaining, teed up by fellow substitute Alessia Russo.
Stanway then sparked delirium among the 28,994 crowd in attendance by firing a stunner past Sandra Panos six minutes into extra time as England secured a place in a fourth successive major tournament semi-final.
The Lionesses, Euros runners-up in 1984 and 2009, will now face either Sweden or Belgium in the last four at Bramall Lane next Tuesday as they continue their quest for a first major piece of silverware.
Stanway said: “Unreal. That just shows the level that we are at, we get a setback and we come back and do it. Job done and focus on the semis.
“It (the goal) is definitely one to be proud of, I will remember today, we put in a massive, massive shift. We are going to enjoy this moment and then crack on.”
Boss Sarina Wiegman added: “The whole game was a test. The level of this game was so high. I haven’t experienced that too much.
We know Spain are a very good team especially in possession. We did pretty well too.
“Plan B was also (used for) a couple of minutes in and then we scored. Then we went back. I’m so proud of the team. Incredible."