Nicky Cadden’s early effort and John McAtee’s double gave the Tykes a commanding lead at the break.
But Horsham were simply excellent in the second half and were unfortunate not to get a goal their attacking play so richly deserved.
The visitors needed just three minutes to take the lead. A deep cross from Adam Phillips caught out Hornets keeper Lewis Carey, who could only palm it out to Cadden to tap home from close-range.
And Barnsley added a second just seven minutes later as a lovely cross from the left from Aiden Marsh was met by McAtee on the volley.
After a lull in the action, the Tykes added their third, in sublime fashion, on 26 minutes. Jordan Williams played a pass over the top of the Hornets defence to pick out McAtee.
The 24-year-old killed the ball dead with an excellent first touch before deftly dinking the ball over the onrushing Carey – and leaving Horsham a mountain to climb in the second half.
But the Hornets started the second period with the bit between their teeth. A driving run from Lucas Rodrigues saw the Brazilian burst into the box, but his shot was tame and straight at Barnsley stopper Ben Killip.
An excellent flowing Horsham move then saw Shamir Fenelon lay the ball off to Bobby Price on the right wing, but his cross was forced out for a corner.
Fleet feet from Daniel Ajakaiye saw the Hornets striker bamboozle three Barnsley defenders before shooting wide as the hosts began to assert themselves in the tie.
Price’s speculative effort from outside the box was charged down by a Tykes player but fell kindly to Lee Harding. The Horsham winger delivered an inch-perfect low cross to Ajakaiye but he couldn’t divert his close-range effort past Killip.
Ajakaiye then twisted and turned in the Barnsley box but his curling shot sailed over the Barnsley goal.
But the Tykes stirred into life midway through the half. A driven cross from Bimal Yoganathan found Phillips but his attempt from point-blank range was sublimely tipped onto the bar and out by Carey.
A ball in from the left from Harvey Sparks found Ajakaiye at the front post but the forward couldn’t direct his shot on target.
Referee Sunny Singh Gill then brought proceedings to an end after 93 hard-fought minutes. The Hornets may not have got the result they wanted on the night, but they certainly could hold their heads high after more than matching the Football League outfit over two games.
Horsham FC: Carey, Price (Richards 77), Sparks, Brivio, Strange, Barker (Kavanagh 46), Hammond (Tuck 77), Rodrigues (Meekums 77), Harding, Fenelon (Daniel 58), Ajakaiye.
Unused: Lelliott, Mazzone, El-Abd, Harris.
Barnsley FC: Killip, Williams (Yoganathan 64), de Gevigney, Cadden (Dodgson 86), Kane, Marsh (Cosgrove 70), McCart, Phillips, Shepherd, McAtee (Watters 70), Connell (O’Keeffe 64).
Unused: Flavell, Cotter, Ackroyd, McCarthy.