Jennifer Hermoso scored two penalties as Spain came from behind to beat World Cup debutants South Africa, who were reduced to 10 players.
Atletico Madrid’s Hermoso converted both spot-kicks in the second half, awarded after a handball and Nothando Vilakazi’s late challenge, for which she received a second yellow card.
Spain were the better side and Lucia Garcia added a cool third late on.
Thembi Kgatlana had given South Africa a shock lead with a chipped finish.
Kgatlana should have put South Africa 2-0 ahead but her tame effort at the far post was pushed away by Spain goalkeeper Sandra Panos.
The result means they are now without a victory in any of their last 12 games and are bottom of Group B.
Spain are top courtesy of better goal difference than two-time winners Germany, who edged past China 1-0 in their opening game.
Jorge Vilda’s side claimed their first victory at the tournament, having failed to win any of their games at the 2015 event, but it did not go to plan early on after Kgatlana’s surprise strike in the first half.
The Spaniards regathered themselves in the second period, Garcia looping a shot against the crossbar, Maria Leon curling a free-kick narrowly over and Marta Corredera seeing a scooped shot pushed away by Andile Dlamini.
But Hermoso did manage to keep her cool from the penalty spot, before Garcia went round Dlamini to slot in with a minute remaining.
Norway scored three first-half goals on the way to an easy win over Nigeria in their opening Group A game at the 2019 Women’s World Cup in Reims.
The 1995 world champions took the lead when Guro Reiten’s shot deflected off Onome Ebi into the net.
Lisa-Marie Utland fired through the hands of keeper Tochukwu Oluehi to make it 2-0 before an own goal by Osinachi Ohale compounded Nigeria’s misery.
Norway are level on points with hosts France, who they face on Wednesday.
Ingrid Hjelmseth, Norway’s 39-year-old goalkeeper, had little to do as Nigeria struggled to carve out chances.
On a bad night for the African champions, defender Faith Michael was carried off on a stretcher after being caught by team-mate Oluehi.