“We showed a lot of grit and experience,” said forward Megan Rapinoe, provider of two goals via penalty kicks, including the tiebreaker in the 75th minute.

“A lot of grit, a lot of resolve,” said Jill Ellis, the coach seeking to guide the top-ranked Americans to consecutive championships.

AD

“A brave performance. … Winning by any means possible,” said center back Abby Dahlkemper, whose defensive unit conceded a goal for the first time since early April.

AD

“We grinded this one out,” said goalkeeper Alyssa Naeher, who was partly at fault for Spain’s goal early in the testy match.

The United States was hardly at its best, but through perseverance, penalty kicks and a late stand, it did its part to set up a dreamy quarterfinal against France on Friday in Paris. Both teams labored to make the match possible — France needed extra time to oust Brazil on Sunday — but here they are, the tournament favorite and greatest threat to the Americans’ reign.

AD

“What a showcase piece,” Ellis said. “I’m sure a lot of people would want it later in the tournament. I think myself and [France Coach Corinne Diacre] probably are both like: ‘You know what? We’ve got good players, good teams, a good setup; let’s go for it.’ ”

The Americans did not have an easy time winning their 10th consecutive match and extending their unbeaten streak to 12. Rapinoe scored early and late, but Spain, in its second World Cup and first knockout match, was on even terms most of the way.

AD

“We gave the best team in the world a run for their money,” Spanish Coach Jorge Vilda said through an interpreter.

From the start, the Spaniards made clear they would not become another U.S. pushover. They had been emboldened by a 1-0 defeat to the Americans in a friendly early in the year and were not the slightest bit intimidated.

AD

Their technical skill and confidence in possession — plus some overheated challenges — tested the Americans more than they have been accustomed. Also, the U.S. defense seemed a little uncomfortable in the beginning — a harbinger of an awful thing to come.

First, though, the Americans went ahead in the seventh minute after Maria Leon took down Tobin Heath infiltrating the right side of the penalty area. Rapinoe converted.

AD

Less than three minutes later, calamity struck. Naeher made a mistake by playing the ball short out of the penalty area to Becky Sauerbrunn, who erred in trying to take possession instead of clearing it from danger.

Lucia Garcia applied high pressure and poked the ball to Jennifer Hermoso, who, with Naeher out of position, lifted a 22-yard shot into the top right corner.

AD

The United States had not conceded a goal since Australia’s Sam Kerr scored late in a friendly in April — a span of 649 minutes.

“Those moments, they can absolutely destroy a team, unravel a team,” Ellis said. “The mental capacity and strength of this team, they kind of parked it and moved on.”

They did move on but struggled to seize control.

Things were not working, but Ellis did not make any substitutions, despite employing the deepest roster in the tournament.

AD

“As a coach, you have to know your players and read those moments,” Ellis said. “There was momentum and some of them grew into it.”

With tension growing, the Americans went ahead on another penalty kick. With Rose Lavelle and Alex Morgan pursuing the ball in the box, Spain’s Virginia Torrecilla raised her right foot and caught Lavelle on the side of her lower right leg.

AD

Referee Katalin Kulcsar awarded the penalty. The Spanish players were incensed.

Kulcsar took the advice of the video assistant referee and trotted to the sideline to watch replays. She determined there was not anything that would prompt her to overturn the call.

“There was definitely contact,” Lavelle said.

As she did on her early goal, Rapinoe targeted the left side and beat goalkeeper Sandra Panos.

Rapinoe’s go-ahead kick, Sauerbrunn said, took her and Naeher off the hook for Spain’s tying goal.

AD

“She is never going to have to buy another drink,” the veteran defender said. “I will supply her with whatever she needs.”

Deep in stoppage time, Spain pleaded for a penalty of its own. Kulcsar allowed play to continue. It appeared to be the right decision.

AD

At the final whistle, the Americans displayed more relief than unbridled joy.

This was, after all, a test like no other in this tournament.

“As we get into these knockout rounds, it’s more stressful, more pressure,” Rapinoe said. “These games are more intense. Every team lifts the level. For us, it was important to stay in it. … Keep grinding, keep together.”

Next: France.

“This is the game,” Rapinoe said, “everyone had circled.”

In-game highlights

by Jacob Bogage in Washington

Final: USA 2, Spain 1

The U.S. women survive a stiff challenge to move on to a World Cup quarterfinal against host France. The teams will meet Friday in Paris in a long-anticipated showdown between the tournament’s two favorites.

AD

AD

90th minute + 6: Press in for Rapinoe

Christen Press comes in late to replace captain Megan Rapinoe, who scored twice.

88th minute: Horan in for Lavelle

Lindsey Horan enters for Rose Lavelle. Horan needs to play carefully, though. She carries a yellow card, and another would force her out of the potential quarterfinal match with France.

86th minute: Lloyd in for Morgan

Carli Lloyd enters to replace Alex Morgan for the United States. Morgan was held off the score sheet, but made key defensive plays late in the half to preserve first a tied game, and then the American lead. The minute before, Spain was issued its first yellow card, issued to Irene Paredes for a foul on Megan Rapinoe.

AD

76th minute: Goal, USA, after VAR upholds penalty

The USA caught a break on offense when a Spanish defender tripped Rose Lavelle in the 18-yard box as she chased down a loose ball in the 71st minute. There wasn’t much contact on the play, but it was enough to knock Lavelle off balance and down to the pitch. The referee consulted VAR to review the play and upheld the call on the field. Megan Rapinoe, who scored on a penalty in the 7th minute, took the kick and scored again to put the Americans ahead 2-1.

Physical play

AD

Things are getting chippy in Reims as the U.S. keeps pushing numbers forward and Spain keeps throwing them on the ground. The referee has called 13 fouls on Spain and three on the United States. American players, Alex Morgan in particular, have complained to officials about the physicality on the pitch and several teammates, including Morgan, Kelley O’Hara and Samantha Mewis, have stayed down on the pitch after tackles.

Second half underway

There were no halftime substitutions made by either side. The U.S. women have never lost a World Cup match in which they scored first, per the Fox Sports broadcast.

Halftime: U.S. and Spain are tied at 1

The opponents have grown stronger with each U.S. match. Even so, Spain has presented another challenge all together through the first 45 minutes of this round-of-16 match.

AD

The Americans are faced with a team that can run with them, that can apply competent pressure on an inexperienced back line and keeper. The result is a 1-1 tie at the half.

The American goal came on a penalty by captain Megan Rapinoe. The Spanish goal came on a misplay by U.S. keeper Alyssa Naeher and was booted home by Jennifer Hermoso.

The Americans have held the ball 61 percent of the time against a side that thrives on possession. But what began as counterattacks soon became routine Spanish forays into the attacking zone and the U.S. back four has been challenged. American midfielders have drifted back to help with the side’s 15 clearances.

That has kept the U.S. from pushing numbers forward, its key to overwhelming victories in the group stage. Thursday’s first half is surely an awakening.

Morgan is struggling

The U.S. is missing the output of Alex Morgan in the first half. After twice getting tangled up with Spanish defenders in the early going, she’s looked winded and out of sorts through the rest of the half. Her injury status had been the subject of speculation since she was replaced at halftime of the previous match vs. Sweden, though Coach Jill Ellis said the move was precautionary and Morgan said she was fine.

37th minute: U.S. yellow card

Megan Rapinoe, the American captain and goal scorer this match, picked up a yellow card for inadvertently swatting a Spanish defender in the face while trying to cut a ball inside.

Spain putting on some pressure

The U.S. has maintained most of possession but Spain on the counterattack has put a great deal of pressure on the U.S. back four and keeper Alyssa Naeher, and cracks are starting to show. Miscommunication between Naeher and the defense enabled Spain’s first goal, and Naeher has mishandled a couple other opportunities, including one that handed Spain a throw deep in attacking territory.

32nd minute: Spain substitution

La Roja has been forced to make an early substitution, as Nahikari Garcia comes in to replace Vicky Losada, whose face was swelling after a collision. U.S. star forward Alex Morgan has also had a rough half but remains in the match.

9th minute: Goal, Spain

The U.S. will want that one back. Keeper Alyssa Naeher had the ball under control in her own box, but played a ball forward to the defense that was easily intercepted. One-on-one with Naeher, Spain’s Jennifer Hermoso deposited a shot in the top right corner to even the score.

It was the first goal allowed in the tournament for the Americans, snapping a streak of 647 minutes without conceding.

7th minute: Goal, USA

Megan Rapinoe made no mistakes with a penalty kick, scoring to give the Americans another dream start against an underdog opponent. They have scored within the first 15 minutes of all four matches. Tobin Heath, who has sparked the offense for the U.S. throughout the tournament, created the chance. She sliced inside the Spanish defense in the 6th minute after running on to the ball and drew a foul in the 18-yard box.

And we’re off!

The weather could play an outsize role in the match. It is a muggy 89 degrees in Reims.

Megan Rapinoe hair color tracker

The fashion-forward American attacker has blond hair in her official team portrait, but has worn her hair a light purple (one might even call it pink) in her first three matches.

But Monday, it’s a much deeper purple and her roots are brown, not blond. So for whatever it’s worth, this should make it much easier to pick Rapinoe out on the pitch.

Do astronauts watch the World Cup in space?

Yes, they sure do. Three Americans aboard the International Space Station gave a tour of the craft and where they catch World Cup action. Turns out, they project the matches on to a giant screen outside the crew’s quarters and there are some 50 computers on board that can stream matches while the astronauts conduct science experiments and service the space station.

Mewis replaces Horan in U.S. starting 11

Midfielder Lindsey Horan, who has scored twice in the Americans’ first four World Cup matches, has been dropped from the starting lineup for Thursday’s match in favor of Samantha Mewis, The Post’s Steven Goff reports.

The move was not injury related, according to the U.S. Soccer Federation. As Goff noted on Twitter, Horan is carrying one yellow card, and another on Thursday would result in a suspension from the quarterfinals should the Americans advance. “Also,” Goff tweeted, “Mewis has been pretty darn good.”

Postgame reading

On the field, the Americans steamrolled through the group stage by scoring a record 18 goals and conceding none in three matches. Off the field, the U.S. women have parlayed their dominant performances into major leverage in the court of public opinion. That, in turn, may translate into legal leverage. (Read more)

The U.S. women’s national soccer team humming through the World Cup is notable for boundless depth, waves of first-class forwards and hearty experience. There are famous players, rising figures and an unapologetic swagger that irks opponents. But behind the scenes — quietly, firmly and armed with a dry sense of humor while her band stacks up goals, victories and endorsements — Coach Jill Ellis has helped define the world’s top-ranked team. (Read more)

Spain has made progress in Europe — 17 wins and a draw in 18 matches with a 67-4 goal differential in the past two World Cup qualifying cycles — but has never played in the Olympics and is a relative newcomer to the world competition. (Read more)