Host South Africa, which needs a strong Confederations Cup to build momentum for next year's World Cup, could only manage a 0-0 tie with Iraq, coached by former U.S. national team coach Bora Milutinovic.
The Bafana Bafana were stymied by a combination of Milutinovic's ultradefensive tactics and bad luck.
The closest South Africa came to scoring was in the 84th minute when South Africa midfielder Kagisho Dikgacoi had goalkeeper Mohammed Kassid beaten, but his header hit the leg of teammate Bernard Parker on the goal line of the empty Iraqi goal.
Milutinovic was happy with the tie for Iraq, which has already been eliminated from the 2010 World Cup, but South Africa's Brazilian coach, Joel Santana, was steaming.
"They were defending even when they were attacking," Santana said. "Their fullbacks never crossed the halfway line."
June 14 in Rustenburg
Spain 5 New Zealand 0.Goals: Fernando Torres, 6, 14, 17, Fabregas 24, David Villa 48.
Spain --Casillas, Sergio Ramos (Alvaro Arbeloa 54), Albiol, Puyol, Capdevila, Fabregas, Xavi (Santi Cazorla 54), Xabi Alonso, Riera, David Villa, Fernando Torres (Silva 70).
New Zealand --Moss, Mulligan, Boyens, Vicelich, Lochhead, Brockie (Christie 28), Elliott, Brown, Bertos, Smeltz (James 76), Killen (Bright 85).
Referee:Coffi Codjia (Benin)
June 14 in Johannesburg
South Africa 0 Iraq 0.
South Africa --Khune, Masilela, Mokoena, Booth, Gaxa, Modise, Dikgacoi, Mhlongo, Sibaya, Parker (Pienaar 85), Fanteni (Mashego 78)
Iraq --Kassid, Abbas, Rehema, Majeed, M.A. Kareem, Shaker, Jassim (H.M. Mohammed 74), Akram, M.Kareem (Sadir 88). E.Mohammed (Zahra 76), Mahmoud.
Referee: Jorge Larrionda (Uruguay).