Match ends, Barnsley 3, Derby County 2.
Adam Hammill grabbed a last-minute winner as Barnsley twice came from behind to beat Derby County and move into the third round of the EFL Cup.
The final second-round tie, delayed after Derby's first-round fixture was abandoned because of rain, saw the Rams lead through Johnny Russell's shot.
Adam Jackson's header made it 1-1 but a Mason Bennett tap-in put Derby ahead.
Tom Bradshaw slid in a second equaliser after the interval, and Hamill's fine strike set up a meeting with Tottenham.
The Tykes almost led inside three minutes when a stunning long-range strike by Harvey Barnes hit the bar, but instead found themselves trailing to Russell's curling effort after great work by Ikechi Anya and Chris Martin.
Barnsley responded impressively, dominating possession and creating more openings.
Jason McCarthy had an effort saved and Bradshaw fired the ball over before Jackson's powerful effort from a Ryan Hedges corner restore parity.
Derby's quality in the final third saw them continue to threaten and, after Russell was denied a second goal by a fine Adam Davies save, Anya teed up the second goal for Bennett.
Bennett spurned a good opportunity to make it 3-1 for the visitors, before Bradshaw and Hammill won the game in the closing stages, ensuring a trip to Wembley to face Premier League side Spurs Tuesday, 19 September.
- 2McCarthyBooked at 77mins
- 20PottsSubstituted forMcGeehanat 88'minutes
- 10MoncurSubstituted forThiamat 66'minutes
- 34HedgesSubstituted forHammillat 61'minutes
- 40BirdSubstituted forGuyat 81'minutes
- 20BennettBooked at 79minsSubstituted forLawrenceat 81'minutes
- Eddie Ilderton
- Shots on Target
Second Half ends, Barnsley 3, Derby County 2.
Attempt saved. Tom Lawrence (Derby County) right footed shot from outside the box is saved in the top centre of the goal.
Callum Guy (Derby County) wins a free kick in the defensive half.
Foul by Tom Bradshaw (Barnsley).
Goal! Barnsley 3, Derby County 2. Adam Hammill (Barnsley) right footed shot from outside the box to the bottom left corner.
Corner, Barnsley. Conceded by Jonathan Mitchell.
Substitution, Barnsley. Cameron McGeehan replaces Brad Potts.
Attempt missed. Ethan Pinnock (Barnsley) header from the centre of the box misses to the right.
Corner, Barnsley. Conceded by Tom Lawrence.
Attempt missed. George Thorne (Derby County) right footed shot from outside the box misses to the right.
Corner, Derby County. Conceded by Ethan Pinnock.
Foul by Joe Williams (Barnsley).
Tom Lawrence (Derby County) wins a free kick on the left wing.
Substitution, Derby County. Tom Lawrence replaces Mason Bennett.
Substitution, Derby County. Callum Guy replaces Max Bird.
Attempt missed. Tom Bradshaw (Barnsley) right footed shot from outside the box is close, but misses to the left.
Attempt missed. Adam Hammill (Barnsley) right footed shot from outside the box is close, but misses to the right from a direct free kick.
Mason Bennett (Derby County) is shown the yellow card for a bad foul.
Harvey Barnes (Barnsley) wins a free kick in the defensive half.