Robertson, aka "Razor", is currently the coach of the New Zealand team Crusaders.
He will replace Ian Foster, who will "lead the All Blacks until the end of Rugby World Cup 2023 in France," New Zealand Rugby said.
Robertson was preferred to Jamie Joseph, the current coach of Japan.
His contract will last until the end of the 2027 World Cup in Australia.
New Zealand Rugby praised Robertson's unparalleled success at the national level, and his reputation as an innovative coach.
"His coaching record speaks for itself in terms of success, but what stood out forcefully during the interview process was his innovative approach to the game, his passion for his players and his desire to contribute to the legacy of the All Blacks," said Federation chief executive Mark Robinson.
A former All Blacks wing thirteenth, Robertson has coached the Crusaders since 2017, leading them to six successive Super Rugby titles. But he never coached a national team.
Ian Foster, who announced in early March that he would not seek a new contract, had been under pressure since last year due to the All Blacks's erratic performances, including a series of defeats against Ireland and their first home defeat to Argentina.
New Zealand Rugby had taken the unusual step of starting the recruitment process well before Foster's contract expired, apparently to prevent rival international teams from poaching Robertson.
© 2023 AFP