Having not conceded a goal heading into the last-16 tie in Reims, USA found matters much tougher against a resilient Spain side.
Maria Leon's reckless challenge on Tobin Heath gifted Rapinoe a chance to open the scoring after seven minutes, which she duly took from 12 yards, only for Jennifer Hermoso to restore parity two minutes later.
USA struggled to click into gear for much of the contest, with star forward Alex Morgan particularly quiet, but they were handed a reprieve when Virginia Torrecilla caught Rose Lavelle.
A lengthy VAR check was required to confirm the referee's decision to award a penalty, but the delay did not bother USA captain Rapinoe, who thumped a low strike into the bottom-left corner.
France awaits at Parc des Princes, as two of the tournament's heavyweights go head-to-head.
Also through to the last eight is Sweden, which beat Canada 1-0 thanks to Stina Blackstenius' clinical effort and a penalty save from Hedvig Lindahl.
Blackstenius scored what proved to be the winner 55 minutes into the tie in Paris, with Sweden's first shot on target.
Canada was given a penalty – the 22nd of the tournament, matching the total number of spot-kicks awarded at the 2015 edition - when Kosovare Asllani was adjudged to have handled after a VAR review, but Janine Beckie could not find a way past Lindahl.
Sweden then saw a penalty of its own overturned by VAR, though Canada failed to take advantage of its good fortune.
Germany, which overcame Nigeria 3-0, will face Sweden in Rennes.