Barnsley warmed up for next Tuesday's Carling Cup clash against Manchester United with a second successive defeat, but they twice hit back from two goals down and were ultimately undone by a second-half penalty that resulted in defender Ryan Shotton's dismissal.
Nicky Maynard fired his ninth goal of the season to give City a 26th-minute lead and then on-loan Ajax midfielder Evander Sno hit his first for the club just before the interval.
Tykes substitute Daniel Bogdanovic hauled Mark Robins' side back into it just after the hour mark before Shotton was deemed to have penalised Danny Haynes in the penalty area in the 73rd minute.
Home goalkeeper Luke Stele pulled off a fine save to keep out Jamie McAllister's spot kick, but Marvin Elliott followed up to bury the rebound and although Adam Hammill fired a second for Barnsley in injury time, City extended their unbeaten run to five matches.
Barnsley pair Andy Gray and Jamal Campbell-Ryce returned to the starting line-up, while City trio Louis Carey, Marvin Elliott and Lee Johnson were all recalled by visiting manager Gary Johnson.
Barnsley went close to taking a 12th-minute lead when Iceland international Emil Hallfredsson drilled in a shot from 25 yards that City goalkeeper Dean Gerken did well to parry and then striker Iain Hume volleyed over the crossbar.
But City took the lead in the 26th minute. Maynard raced on to a speculative ball forward and held off two challenges to slot the ball under advancing goalkeeper Steele from inside the penalty area.
Elliott then headed McAllister's free-kick wide as the Robins looked to double their lead and Carey curled a long-range effort just off target.
But the visitors went further ahead three minutes before the break when Sno clinically despatched a cross from Haynes into the bottom corner from 12 yards.
Maynard and McAllister caused further alarm in the home ranks with shots from outside the area as City finished the first period in complete control.
Tykes' substitute Bogdanovic replaced Hume during the interval and before long manager Robins swapped Campbell-Ryce with Anderson De Silva in a bid to galvanise his side.
Barnsley's response was immediate, with Gray's snap-shot from inside the area well saved by Gerken, who then gifted the home side with a route back into the match in the 62nd minute.
Bogdanovic's low 20-yard shot appeared to be covered by the City goalkeeper, but the ball squirmed underneath him and over the line.
Barnsley were dealt a hammer blow in the 73rd minute when referee Haines adjudged Tykes defender Shotton to have hauled down Haynes in the area.
Shotton was shown a straight red card for a professional foul and although McAllister's subsequent power penalty was brilliantly saved by Steele, Elliott followed up to volley home the rebound.
Barnsley refused to surrender and although time was running out Hammill gave them hope with a fine curled effort into the top corner following Hallfredsson's lay-off, but City held on.