JOHANNESBURG - Substitute Daniel Alves scored two minutes from time to give holders Brazil a hard-earned 1-0 win over hosts South Africa on Thursday and a place in the Confederations Cup final. Alves, who had only been on the field for six minutes, lashed home a direct free kick from the edge of the penalty area after South Africa captain Aaron Mokoena had fouled Ramires. Brazil, bidding to retain the trophy they won in 2005, now face United States in Sunday's final while South Africa meet Spain in the third-place playoff in Rustenburg the same day. Itumeleng Khune made a point blank save with his feet to deny Brazil a second goal when Luis Fabiano was one-on-one with the young South Africa goalkeeper. The late flurry was among few moments of enterprise for Brazil, who were playing their sixth international in three weeks and seemed content to soak up most of the pressure. At times it appeared South Africa might add to the list of shock results at the two-week tournament which had already seen World Cup holders Italy beaten by Egypt in the group phase and European champions Spain sunk by the U.S. in Wednesday's semi-final in Bloemfontein. ENTERPRISING HOSTS The 2010 World Cup hosts, who have been in the doldrums for several years, looked enterprising and were a match for Brazil for most of the game but lacked a finishing touch. South Africa had the better of the first half chances, testing Brazil goalkeeper Julio Cesar with two long range shots while Mokoena headed over from one metre in the 21st minute. A Siphiwe Tshabalala free kick was also palmed over and at the other end Julio Cesar got a fingertip to deny Steven Pienaar's rasping effort two minutes before halftime. The hosts were tentative at first, with some wild defensive clearances reflecting their nerves, but then gained confidence as they enjoyed most of the possession. However, when they got to the edge of the Brazilian area they seemed unsure in their decision making. Brazil, twice winners of this trophy, were content to sit back for much of the first half but were swift on the counter attack with Kaka twice surging forward only to see his efforts thwarted. After the interval Julio Cesar had to scramble to turn away a deflected shot from Teko Modise while Bernard Parker missed a chance from Tshabalala's whipped cross.