Barrett, who replaced Aaron Cruden in the first half after his fellow first five suffered a neck injury, broke the game open by setting up Ben Smith's try then scored himself after Wales had fought back to 10-10 at half-time.
Cruden's injury, which local radio reported as being a suspected 'compression neck injury' had actually brought the Welsh back into the game with the 27-year-old needing treatment for about 10 minutes before being carried off on a stretcher.
A New Zealand Rugby spokesperson said he had been taken to hospital for 'precautionary' tests. The X-rays on his injured neck showed nothing broken, with the initial prognosis that Cruden will be fine, and he's suffered no major damage.
Until Cruden's injury, the visitors appeared to be struggling with the tempo of the game and despite having plenty of ball and being prepared to use it, looked bereft of too many attacking ideas.
They also faced a resolute wall of defence and failed to make any ground over the advantage line or win the collisions.
Wales lock Alun Wyn Jones scored a try after Cruden's injury, while Liam Williams and Jonathan Davies scored tries in the final six minutes after the All Blacks had established a 36-10 lead.
First five Dan Biggar slotted two conversions and added a 16th minute penalty.
Smith and Israel Dagg, both playing their 50th Tests, crossed the line for the All Blacks, who scored five tries. Waisake Naholo and Ardie Savea, who finished off a sweeping movement for his first Test try in his second match, were the other scorers.
Barrett, who also scored a try, added three conversions, while Cruden converted Dagg's try and kicked a penalty before he was injured when Wales lock Luke Charteris rolled over the top of him in a tackle.
The third and final Test is in Dunedin next Saturday.
Photo: AFP Wallabie coach Micheal Cheika and captain Stephen Moore