But the Baby Blacks' win was not enough to keep contention for the title as Ireland U20 topped Pool A by beating Georgia 35-7 in Manchester.
Wales U20 and New Zealand U20 will meet again on Monday 20 June in a 5th-place semi-final.
Dan Jones kicked four Wales penalties and Joe Thomas scored an early try.
But Barrett struck after tries from Sam Nock and Shaun Stevenson.
Barrett is the younger brother of Beauden, who helped the All Blacks beat Wales in last weekend's first Test.
The defeat for Wales' junior team also came as Warren Gatland's senior team hope for redemption following Tuesday's 40-7 setback at Chiefs.
The 12 teams at the Junior World Championship will all battle for ranking positions in play-offs that follow the conclusion of the Pool stage.
The winners of the Wales U20 v New Zealand U20 will face either their Scottish or Australian counterparts in the battle for fifth spot.
Wales Under-20: Rhun Williams (Cardiff Blues); Tom Williams (Ospreys), Joe Thomas (Ospreys), Harri Millard (Cardiff Blues), Jared Rosser (Newport Gwent Dragons); Daniel Jones (Scarlets), Reuben Morgan-Williams (Ospreys); Corey Domachowski (Cardiff Blues), Dafydd Hughes (Scarlets), Dillon Lewis (Cardiff Blues), Shane Lewis-Hughes (Cardiff Blues), Seb Davies (Cardiff Blues), Tom Phillips (captain, Scarlets), Shaun Evans (Scarlets), Harrison Keddie (Newport Gwent Dragons).
Replacements: Liam Belcher (Cardiff Blues), Rhys Fawcett (Scarlets), Leon Brown (Newport Gwent Dragons), Josh Macleod (Scarlets), Morgan Sieniawski (Cardiff Blues), Declan Smith (Scarlets); Jarrod Evans (Cardiff Blues), Billy McBryde (Scarlets).
New Zealand Under-20: Shaun Stevenson; Caleb Makene, Patelesio Tomkinson, Jordie Barrett, Jonah Lowe, TJ Va'a, Sam Nock; Ayden Johnstone, Leni Apisai (captain), Sosefo Kautai, Quinten Strange, Hamish Dalzell, Fin Hoeata, Mitchell Jacobson, Marino Mikaele-Tu'u.
Replacements: Asafo Aumua, Sean Paranihi, Alex Fidow, Isaia Walker-Leawere, Luke Jacobson., Jonathan Taumateine, Stephen Perofeta, Malo Tuitama.
New Zealand's youngster's added to Welsh agonies as centre Jordie Barrett kicked a late penalty to beat them at the Junior World Championship.