South Africa sensationally upset the All Blacks 36-34  in Wellington to win in New Zealand for first time since 2009.

In a thrilling match filled with plenty of drama, the Boks were deserved winners as they held the lead for most of the match.

The All Blacks outscored their visitors by six tries to five although poor goalkicking from Beauden Barrett cost the world champions in the end as he missed four shots at goal.

The win is a momentous result for the Springboks as it is their first triumph on New Zealand soil since 2009 and this is the All Blacks' first defeat in the Rugby Championship since 2015.

South Africa were under the cosh early on when Handré Pollard's kick to get the game underway went over the deadball line and after an extended period camped inside the Boks' half, the All Blacks opened the scoring in the fifth minute when Jordie Barrett gathered a pass from his brother Beauden and glided through a gaping hole in the visitors' defence before crossing for the opening try.

The older Barrett failed with the conversion attempt but the All Blacks continued to dominate and spent long periods camped inside South Africa's half during the next 10 minutes.

And in the 16th minute, Ben Smith made a superb line break down the right-hand wing before throwing an inside pass to Aaron Smith, who cantered in for an easy five-pointer.

Barrett made up for his earlier miss and added the extras which gave the world champions a deserved 12-0 lead.

The visitors did not panic, however, and struck back midway through the half with a well-taken try from Aphiwe Dyanti after good work from Malcolm Marx and Willie le Roux in the build-up.

That try was converted byPollard and although the Boks were trailing by five points, they were the dominant side for the next 15 minutes and were rewarded with two further tries during that period.

First, Jordie Barrett took a quick throw-in at a lineout just outside his 22 but his throw was an inaccurate one and Le Roux gathered the bouncing ball from under the nose of Rieko Ioane before crossing for the visitors' second try.

And in the 32nd minute, the Boks went further ahead when Marx crossed the whitewash off the back of a lineout drive deep inside the All Blacks' 22. Pollard converted both those tries which meant South Africa had their tails up with the score 21-12 in their favour.

The All Blacks needed a response and that came in the 38th minute when the ball was shifted to Rieko Ioane, who found himself in space out wide and he had an easy run-in for his side's third try.

The Boks would have the final say of the half, however, when just before half-time Pollard added a penalty which gave his side a 24-17 lead at the interval.

The visitors made a dream start to the second half when two minutes after the restart Cheslin Kolbe intercepted a pass from Anton Lienert-Brown before racing aware to score his side's fourth try.

Pollard's conversion was successful which meant the Springboks were leading 31-17 but the All Blacks struck back 10 minutes later when Ioane gathered a pass from Beauden Barrett before stepping past Kolbe on his way over the tryline.

But despite that score, the Springboks continued to attack and in the 57th minute Dyanti rounded off a flowing move - in which RG Snyman, Steven Kitshoff, Elton Jantjies and Warren Whiteley all handled the ball superbly - which gave his side a 36-24 lead.

That boosted the Boks' confidence but it did not deter the All Blacks who came roaring back in the 61st minute when Codie Taylor crossed the whitewash after a lineout drive close to the visitors' tryline.

The final quarter saw the All Blacks launching several attacks deep inside the Springboks' half as they looked to retain their unbeaten record in the competition. In the 67th minute, South Africa were reduced to 14 men when Willie le Roux was yellow carded for taking Ioane out from an offside position close to the Boks' tryline.

With a numerical advantage, the All Blacks upped the ante on attack and were rewarded when Ardie Savea crossed the whitewash in the 74th minute after another lineout drive deep inside Bok territory.

The closing stages was a tense affair with the world champions continuing to attack close to the Boks' tryline but the visitors kept them at bay with a heroic defensive effort and held on for a memorable win.

For New Zealand:
Tries: J Barrett, A Smith, Ioane 2, Taylor, Savea
Cons: B Barrett 2

For South Africa:
Tries: Dyanti 2, Le Roux, Marx, Kolbe
Cons: Pollard 4
Pen: Pollard 
Yellow Card: Le Roux

New Zealand: 15 Jordie Barrett, 14 Ben Smith, 13 Anton Lienert-Brown, 12 Ryan Crotty, 11 Rieko Ioane, 10 Beauden Barrett, 9 Aaron Smith, 8 Kieran Read (c), 7 Sam Cane, 6 Liam Squire, 5 Scott Barrett, 4 Samuel Whitelock, 3 Owen Franks, 2 Codie Taylor, 1 Karl Tu’inukuafe
Replacements: 16 Liam Coltman, 17 Tim Perry, 18 Ofa Tuungafasi, 19 Patrick Tuipulotu, 20 Ardie Savea, 21 TJ Perenara, 22 Jack Goodhue, 23 Damian McKenzie

South Africa: 15 Willie le Roux, 14 Jesse Kriel, 13 Lukhanyo Am, 12 Damian de Allende, 11 Aphiwe Dyantyi, 10 Handré Pollard, 9 Faf de Klerk, 8 Warren Whiteley, 7 Pieter-Steph du Toit, 6 Siya Kolisi (c), 5 Franco Mostert, 4 Eben Etzebeth, 3 Frans Malherbe, 2 Malcolm Marx, 1 Steven Kitshoff
Replacements: 16 Bongi Mbonambi, 17 Beast Mtawarira, 18 Wilco Louw, 19 RG Snyman, 20 Francois Louw, 21 Ross Cronjé, 22 Elton Jantjies, 23 Cheslin Kolbe

Referee: Nigel Owens (Wales)
Assistant referees: Pascal Gaüzère (France), Nic Berry (Australia)
Television match official: Rowan Kitt (England)