South Africa had unsettled Brazil with a frantic hustling game of quick challenges and tight marking from a packed midfield and attentive defense, but the substitute right back curled in a shot from the edge of the area to give his team a chance of a record third title after Ramires tumbled right on the edge of the area under a challenge from South Africa captain Aaron Mokoena.
South Africa had displayed far more energy and guile than Brazil and was denied a famous victory only by the lack of a finishing touch up front.
In Sunday's final at Ellis Park, the Brazilians will face the United States, which upset European champion Spain 2-0.
Just four days after routing World Cup holder Italy 3-0, Brazil looked short of ideas and laboured in its efforts to find an opening - largely trying to play through the middle.
But that was mostly due to a vastly improved home team, which covered almost 10 percent more ground throughout the game and matched their opponents' 12 shots on goal.
Only former world player of the year Kaka seemed able to direct his passes with any regular accuracy as South Africa equalled its illustrious opponents' skill and surpassed their work rate.
With central defender Matthew Booth snuffing out almost every attempted attack from the wayward Luis Fabiano and ineffective Robinho, Brazil's best chances had been shots from Ramires, Andre Santos and Kaka that goalkeeper Itumeleng Khune easily saved.
Where almost everything Brazil attempted in its 3-0 win over worked, the ball inexplicably seemed to get stuck under the players' feet at Ellis Park.
"We played in a similar way to the way we did against Spain," Booth said. "We knew Brazil would have a lot of possession and we had to get players behind the ball. But we had a go at them."
South Africa finally showed fans they could be something of a force at next year's World Cup, shrugging off indifferent group form to outplay the record five-time World Cup winners.
Backed up by Siphiwe Tshabalala, who replaced the suspended MacBeth Sibaya, Teko Modise put three disappointing displays behind him to drive the home midfield and came close to securing a famous win when his 58th-minute shot deflected off defender Luisao and almost beat goalkeeper Julio Cesar.
"Had opportunities for the goal," South Africa coach Joel Santana said. "Congratulations Brazil."
South Africa displayed far more purpose and skill than in its first-round group, where it progressed with a 0-0 draw with Iraq and 2-0 win over New Zealand.
And, just as importantly, it made clean tackles in defense to deny Brazil the set pieces from which it can be deadly efficient.
Until the 88th minute, that is.
"We wanted to come here and win but unfortunately we did not go all the way," Booth said. "We were not very happy with the free kick (that led to the goal) and I think television replays will show it was unfair."