South Africa's Elton Jantjies nailed a last-gasp penalty in a thrilling 31-29 win over New Zealand to deny the All Blacks a Grand Slam at the Rugby Championship.

Jordie Barrett, whose late kick secured the title in a 19-17 victory over the Springboks last week, looked to have sealed a sixth win from six for New Zealand in similar fashion on the Gold Coast on Saturday.

That was until Jantjies struck with the final action of an enthralling contest to end a 10-match winning streak for Ian Foster's men.

Lukhanyo Am's terrific behind-the-back pass led to Damian de Allende's opening try before an exchange of penalties kept South Africa five points ahead.

New Zealand levelled when Sevu Reece just made the corner after a fine Beauden Barrett kick, and despite another Handre Pollard penalty, the All Blacks were soon in command.

A fast, flowing move ended with Ardie Savea going over under the posts and Brad Weber added another try two minutes later following a lineout steal.

Then, momentum shifted. Pollard made no mistake with two more penalties to close the gap to three points, and the Boks were ahead 53 minutes in when Makazole Mapimpi crossed in the corner after the ball was worked from the opposite flank.

Replacement Jantjies stretched the lead further with another penalty, only after play was brought back following an advantage when Faf de Klerk fumbled at the breakdown barely a metre from the try line.

Jordie Barrett reduced the arrears as tensions began to build, although the Hurricanes back kept his cool to kick his side into the lead with five minutes left after South Africa were penalised for holding on.

A gripping finale saw Jantjies sink a brilliant drop goal a minute later only for Jordie Barrett to send another late kick sailing through the posts in what looked like a repeat from a week ago.

But South Africa came again, a lineout inside the New Zealand 22 leading to a penalty right in front of the posts, from which Jantjies made no mistake.

Boks rewarded for perseverance

At risk of a fourth consecutive Test defeat for the first time since 2016, the world champions were rewarded for a bold but clean display in which they refused to allow New Zealand to sustain first-half momentum.

This was only the second time the All Blacks have lost a Test match in Australia against anyone other than the Wallabies and showed the Springboks' performance in that narrow previous defeat was no flash in the pan.

All Blacks off the boil

This was something of an off-day for New Zealand after an exemplary championship, as they yielded both possession and territory surprisingly easily.

Giving up eight turnovers and losing six rucks overall did not help their cause in a game of fine margins.