Thembi Kgatlana, who plays for Chinese club Beijing Phoenix, gave South Africa the shock lead through a right-foot curl-in, before Jennifer Hermoso converted duo penalties for Spain to turn the table.
Spain was awarded another penalty on 81 minutes after Nothando Vilakazi's late challenge which saw her receive a second yellow card.
Lucia Garcia then put the game beyond reach in the 89th minute after she went past keeper Andile Dlamini to score her first global goal.
Cape Town - Banyana Banyana relish opened their FIFA Females's World Cup advertising and marketing and marketing campaign with a painful loss to Spain on the Stade Oceane in France on Saturday.
Spain was not done, though, as Garcia capped her impressive cameo with a composed finish to move the team to the top of Group B.
Gwinn's powerful 66th-minute shot from the edge of the penalty area flew into the left corner.
The sides both struck the woodwork before the deadlock was broken, Yang Li hitting the upright when presented with a fine opportunity to score after opponent Carolin Simon had rattled the bar in a tense clash.
In yesterday's third game, Guro Reiten and Lisa Marie Utland scored to help Norway open the tournament with a 3-0 victory over Nigeria.
Nigeria were hurt when defender Faith Michael was stretchered off after a collision with her keeper early in the second half.
South Africa will be hoping their 7-2 loss to Norway last Sunday in a friendly worldwide will not dampen their morale as they are the lowest ranked side in Group B.
New Zealand start their tournament with a match against the Netherlands on Wednesday at 1am.