JOHANNESBURG - Brazil coach Dunga said he brought on Daniel Alves as a late substitute because if his team earned a free kick near South Africa's goal the player could win Thursday's game - which is exactly what happened. Alves replaced Andre Santos in their Confederations Cup semi-final against the host nation, who had kept out Brazil for 82 minutes and had carved the better chances. "The match was very even and I decided we needed a quick, aggressive player, a specialist at set-pieces," Dunga told a news conference. "Daniel Alves trains every day at set-pieces and I thought if we had a few opportunites left to try and win the match with a free kick in front of goal, he would be the man. "It turned out perfect for us (with an 88th-minute free kick winner from Alves) but it was a very difficult game. They made it very hard for us. We knew South Africa were going to counter-attack and defend very deeply and they did." Dunga said it was special to be facing a South African side managed by his former Vasco da Gama manager, Brazilian Joel Santana. "Without a doubt," he said, "not only because he is a Brazilian coach but all his assistants are Brazilian and this made our task all the more difficult." Looking ahead to Sunday's final against United States, who Brazil beat 3-0 in the group stage last week, Dunga said: "They have their own peculiar way of playing. "We will sit down and analyse what we have to do to beat them but that will not be easy either." SANTANA PLEASED South Africa coach Santana said he was pleased with his team's performance. "We played very well, we defended well and I am very proud of my team for holding one of the best teams in the world and the five-times world champions for 88 minutes," said Santana. "Perhaps we even surprised them with the way we played but we could have been a bit calmer in front of goal. We have another year to prepare ourselves for the World Cup and we have a very strong foundation to build on now." While Brazil face the U.S. in Sunday's final, South Africa meet Spain in the third-place playoff the same day. That match though will not have quite the same emotional effect on Santana as playing Brazil. "It was amazing to play against Brazil, my own country and the land of my birth. It was emotional and I am happy and proud," he said.