The result condemned Coventry and Portsmouth to relegation.
The Robins had to battle hard against a Barnsley side who enjoyed much of the ball in the first half without finding a way past their lowly hosts.
And they were rewarded by Cole Skuse's first-half strike and Jonathan Stead's penalty six minutes after half-time.
City dominated the game after Stead's spot-kick, and could have scored twice more through the striker and Neil Kilkenny, but for two good saves by David Button in the visitors' goal.
Although that third goal never came, the home side successfully avoided the drop to League One.
Nathan Doyle had the game's first effort on goal after just three minutes, but the Barnsley midfielder's speculative 30-yard attempt flew harmlessly over the crossbar.
Kallum Higginbotham worked Dean Gerken in the City goal from 12 yards out in the eighth minute, but the hosts went down the other end and took the lead with their first chance of any note.
Stead and Chris Wood combined well in a free-flowing move to tee up Skuse, who beat Button to register his second goal in as many games.
The visiting Tykes tried to rally, but were restricted to efforts from distance, and Doyle's drive was blocked by Liam Fontaine before Stephen Dawson shot high and wide and Stephen Foster nodded over.
The match meandered somewhat towards half-time, with both sides cancelling each other out in midfield and chances came at a high premium.
Stead fired straight at Button in a rare foray forward for the home side, as Barnsley monopolised possession without finding any kind of cutting edge, and the visitors went into the break trailing.
Moments into the second period, City found the second goal that assured themselves of a place in the Championship next term.
The Barnsley defenders were shocked to see referee Darren Deadman award the hosts a penalty in innocuous circumstances when the ball was crossed into the box, but Stead was not complaining and stepped up to beat Button from the spot.
The Robins should have extended their lead even further four minutes later, but Stead saw his point-blank effort from Albert Adomah's cross tipped over by Button.
Barnsley struggled to find a way back into the contest, with Jim O'Brien heading over, and City ended the game at a canter.
Ryan McGivern fired wide from 12 yards and Button stopped substitute Kilkenny's effort from close range as the home side eased to victory.
Any reproduction, publication or redistribution of this material without the written agreement of 365 Media Group is strictly forbidden.