The United States needed two penalties to see off a stubborn Spain side and advance to the quarter-finals of the Women's World Cup with a 2-1 win in Reims.
Megan Rapinoe scored from the spot in both halves, either side of an equaliser for Jennifer Hermoso, to keep alive American hopes of a fourth World Cup title.
But this was far from the straightforward victory many would have predicted as Spain provided a stern test of the defending champions.
Spain were the first to threaten, less than a minute in, with Becky Sauerbrann getting her head in the way to block Patri Guijarro's powerful shot.
Moments later, the States had their first penalty as Mario Leon caught Tobin Heath inside the box and Rapinoe sent Sandra Panos the wrong way with a shot into the bottom left-hand corner of the net in the fifth minute.
But Spain quickly responded, punishing a defensive howler at the back. Sauerbrann was dispossessed by Lucia Garcia after an unwanted short pass from goalkeeper Alyssa Naeher, and when the ball fell for Hermoso she lifted a fine shot into the right corner of the net.
Rapinoe almost had the Americans straight back in front when she met a sweeping ball from Alex Morgan, but they soon learned they would be made to work hard by a Spanish team that grew in confidence as the game went on.
The pressure began to build again early in the second half but Rose Lavelle sent the best chance narrowly over the crossbar.
Instead, the States would need another spot-kick, their second coming when Virginia Torrecilla caught Lavelle in the box.
Morgan initially stepped forward, looking for a sixth goal that would put her clear in the tournament scoring charts.
But, after a lengthy video review which led to a six-minute stoppage in play, it was Rapinoe that took responsibility.
Panos guessed right this time as Rapinoe picked the same spot, but the result was the same with the goalkeeper unable to get down in time.
Rapinoe was in the mood for a hat-trick. Out on the left, she hit an audacious effort with the outside of her right boot and watched it sail narrowly wide of the far post from a tight angle.
A third would have been harsh on Spain, whose performance will have been noted by those aiming to dethrone the Americans.