The All Blacks have lost their final match of the Rugby Championship, beaten 27-25 by South Africa in a thrilling encounter at Johannesburg's Ellis Park.
Down 21-13 at half-time, New Zealand stormed back into the contest with two late tries to claim a 25-24 lead going into the dying stages of the match.
The All Blacks defended their advantage tenaciously as the clock ran down, however with less than two minutes remaining the Springboks were awarded a penalty on halfway after replacement loose forward Liam Messam was pinged for a high tackle.
The sniff was all the Springboks needed, with replacement first-five Patrick Lambie cooly slotting the 52 metre kick attempt to snatch victory from the jaws of defeat.
Captain Richie McCaw was disappointed to have marked his record 134th match for the All Blacks with a loss, though he says his players left everything on the field.
It's the Springboks' first win over the All Blacks at Ellis Park since 2004, and their first win over New Zealand anywhere since 2011 - while it's the All Blacks' first loss to anyone in two years.
It's also their only defeat of the 2014 Rugby Championship, though they had already claimed the title last week.
Lambie was on for the 20-year-old rookie pivot Handre Pollard who had earlier crossed for two tries, and added three conversions and a penalty at Ellis Park as the Boks became the first team to defeat the world champion All Blacks since England in late 2012.
Halfback Francois Hougaard scored the home side's other try as their desire to play a more expansive game with ball in hand paid dividends.
New Zealand's points came via tries from centre Malakai Fekitoa, wing Ben Smith and hooker Dane Coles, with first-five Beauden Barrett adding a further 10 with the boot.