The United States will take on France in the quarter-finals of the Women's World Cup after two Megan Rapinoe penalties squeezed them past Spain 2-1 on Monday.
The reigning world champions will face the hosts in Paris on Friday in a match that could well decide the destiny of the tournament after Rapinoe struck from the spot in the seventh and 75th minutes.
Spain had got themselves back into the game two minutes after Rapinoe's opener through a fine lob from Jennifer Hermoso following sloppy play at the back from the Americans. The USA thought they were ready for an easy afternoon when Tobin Heath was brought down by Maria Leon after brilliantly collecting Abby Dahlkemper's searching long pass.
Rapinoe lashed home the subsequent penalty to send the overwhelmingly American crowd wild, but Spain stunned them back into silence shortly afterwards.
Goalkeeper Alyssa Naeher played a sloppy pass to a dozing Becky Sauerbrunn, who let Lucia Garcia nip the ball from her feet before feeding Hermoso who arced a super strike over Naeher.
Spain held their own against a team most observers expect to lift the trophy in Lyon come July 7, but were undone with 15 minutes left when referee Katalin Kulcsar whistled for another spot-kick following what looked a soft foul on the lively Rose Lavelle from Virginia Torrecilla.
The penalty was confirmed after a VAR check and Rapinoe smashed the ball into the same corner to give the USA the tightest of wins and set a date with the French in what will be the most highly-anticipated match of the tournament.