Daniel Alves [Images] scored direct from a free-kick two minutes from time to give Brazil [Images] a hard-earned 1-0 win over hosts South Africa [Images] on Thursday and a place in the Confederations Cup final.
Substitute Alves, who had only been on the field for six minutes, lashed home a shot from the edge of the penalty area after South Africa skipper 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 play-off.
South Africa's best chance came in the first half when Mokoena headed over the bar from a metre out.