The United States went up 2-0 on an own goal off Jonna Andersson in the 50th minute.
The hard-fought win means the USA advance to a quarterfinal matchup with France in Paris on Friday.
The winning spot kick was subject to much debate but Rapinoe converted it with 15 minutes left after her opening penalty had been canceled out by Jennifer Hermoso early in the first half.
In their most hard test thus far, the defending champions came through unscathed, securing a comfortable 2-0 victory against Sweden to make it three wins from three in France with no goals conceded. It was the first goal conceded by the USA in the tournament and in 647 minutes.
Megan Rapinoe of the United States of America scores her team's second goal from the penalty spot during the 2019 FIFA Women's World Cup France Round Of 16 match between Spain and US on June 24, 2019 in Reims, France.
Referee Katalin Kulcsar took the advice of the video assistant referee and watched replays before certifying the foul. "Rapinoe did an absolutely incredible job with those two goals".
Spain took advantage of some disastrous play out of the back just two minutes after Rapinoe's opener, and found a quick equalizer through Jenni Hermoso's strike. But coach Jill Ellis took some of the blame away from Naeher as she praised the goalkeeper for rebounding from her mistake. She was tackled in the last game against Sweden and didn't return for the second half.
"You can talk tactics, but heart, grit and resolve - that's a big part of World Cup soccer".
From the start, the Spaniards made clear they would not become another pushover. They don't come in and put everyone on edge like they used to.
Women have been barred from attending matches since the 1979 Islamic revolution, with clerics arguing they must be protected from the masculine atmosphere and sight of semi-clad men.
A lengthy VAR check was required to confirm the referee's decision to award a penalty, but the delay did not bother U.S. captain Rapinoe, who thumped a low strike into the bottom-left corner.
Three minutes later, calamity struck.
Spain didn't need a motivational speech to understand the magnitude of the game against the United States. The challenge for her is that decision-making often comes from experience and the ability to read the game. "The strength of this team is that we have a lot of strengths", said midfielder Rose Lavelle. She scored again, same kick as her first with Panos guessing correctly, but not diving down fast enough.
Both sides pressed for control in the early portion of the second half.
Lavelle's 20-yard effort streaked over the crossbar and Spain's Patri Guijarro slid an angled shot beyond Naeher's reach and wide of the far post. "I don't have a rear-view mirror", she told reporters after the match.
Lloyd should have scored a third in the dying minutes, but the striker drew a fine save from Hedvig Lindahl. Germany advanced to the quarterfinals for the eighth straight time, beating African champion Nigeria 3-0 on Saturday. It is wonderful to see and I think they can win the World Cup in 2023.
That set the tone for the game: Penalty, penalty, penalty.
The favourites then appeared to be in total control until a terrible defensive mix-up between Alyssa Naeher and Becky Sauerbrunn allowed Spain to seize possession just outside the box, and Jennifer Hermoso scored with a wonderful finish - the first goal that had conceded in the tournament so far. Eight of Sinclair's goals have come against Sweden.
With progress also assured Sweden made seven changes to the team which beat Thailand in its last outing.
For athleticism, for speed, for attacking prowess the United States is without equal at this Women's World Cup. Their best finish was runners-up in 2003.
- Seven bikers killed after truck plows through riders in the US
- Rumored Galaxy A90 to launch under the Galaxy R series
- Johnson government faces rapid collapse over Brexit, warns Hunt
- Amazon Prime Day 2019 Date Revealed: It All Starts July 15
- Body found in search for popular YouTuber Desmond 'Etika' Amorah
- U.S. border agency acting head resigns amid child detentions outcry
- USA without Ertz against Sweden because of hip contusion
- Trump announces new sanctions against Iran
- Trump says will be Iran's 'best friend' if it renounces nuclear arms
- Sri Lanka plot how to douse England World Cup fireworks