South Africa coach Jake White admitted his relief after the Springboks secured a narrow 30-25 win over Tonga in the World Cup Pool A game in Lens.
White began the game with a reserve SA side
White had made 11 changes for the match, but with South Africa trailing 7-10 in the second half, he was forced to introduce five first-choicers.
"I'm very relieved - credit to Tonga, they were outstanding," said White.
"We had opportunities for tries but dropped the ball. We could have been 20 points ahead at the break."
The Springboks surged 27-10 clear but brave Tonga fought back with two quick tries to set up a thrilling finish.
South Africa clung to their lead in a desperate last 10 minutes but the bonus-point win sealed the group.
"I think the substitutes saved me... This was a test and although we have not done as well as well as we would have liked, we passed it," White said.
Tonga coach Quddus Fielea said South Africa had underestimated them by fielding a second-string side.
"Seeing most of their first team players on bench, we knew that they didn't know what was going to happen in this game," he said.
Tonga captain Nili Latu hailed the team's improved discipline and confidence in their own game.
"I'm really proud of my boys. Tonga used to concentrate on their opponents, now we concentrate on ourselves and our game plan and if we execute we have a good chance of winning," he said.
"We had been watching South Africa's power and speed and saw the only way to beat them was by being smart.
"We knew the forwards were going to bash us up front. We said if we can tackle low and get in their face they won't like it... Little mistakes cost us the game today."
South Africa flanker Danie Rossouw was carried off on a stretcher during the second half but White said he was not badly hurt.
"The feedback from the doctor is he's all right, much better than what it looked like when he was carried off. He's gone for a scan but we think he will be okay," he said.
The Springboks, who have yet to face the USA in their final pool match, will probably face Wales in Marseille on 7 October in their quarter-final.