Academy graduates Jordan Clark and Reuben Noble-Lazarus got their names on the score-sheet against the Rams - who included seven professionals in their starting XI.
Clark, who is currently on loan with Hyde FC, opened the scoring after 15 minutes with a neat finish but his strike was cancelled out by Derby's Kwame Thomas before the break.
Andy Thomas scored Derby's second before Kwame Thomas hit his second to make it 3-1.
Reuben Noble-Lazarus reduced the deficit but George Thorne secured the points in the 64th-minute with the last goal of the game for 4-2.
Barnsley's only two senior professionals were, incidentally, former Rams in the shape of Tomasz Cywka and Lewin Nyatanga.
First-year Academy scholar Mason Holgate came on for the last 20 minutes and impressed during his short stint on the field.
Derby County U21 XI: Legzdins, Hanson, Naylor, Bailey, O’Brien, Whitbread, Dales, Thorne, Thomas, Bennett, Hoganson.