Bristol City secured a sixth successive season in the Championship with a convincing victory over Barnsley at a packed Ashton Gate.
An early strike by Cole Skuse gave Derek McInnes's side the perfect start.
Jon Stead made sure of victory by converting a controversial penalty early in the second half as City extended their unbeaten run to seven league matches.
The result condemned Portsmouth and Coventry City to relegation.
McInnes 'relieved' to escape drop
A near sell-out crowd visited Ashton Gate, both in hope and expectation, and they were not to be disappointed.
Barnsley's Nathan Doyle sent an early warning shot fizzing over Dean Gerken's crossbar, while Stephen Dawson also went close.
But, although the visitors' play was muscular and committed, it was devoid of the finesse required to create anything more clear-cut. City were altogether more clinical.
The opening goal came from City's first shot on target as a short, sharp exchange of passes between Stead and Chris Wood released Skuse into the penalty area. The City midfielder took his chance delightfully, forcing a low shot beyond Barnsley goalkeeper Button and into the far corner of the net.
Did you know?
Bristol City's win took them above opponents Barnsley and into 19th in the Championship table
Albert Adomah was a constant thorn in Barnsley's side, creating one chance for Stead and another for Skuse with his searing turn of pace down the right flank.
It was from one such surge that City were denied a penalty as half-time approached, with referee Darren Deadman waving away appeals when the ball struck Scott Wiseman's arm.
Minutes into the second half, the referee did point to the penalty spot, adjudging Barnsley captain Jimmy McNulty to have pulled back Ryan McGivern as he attempted to connect with Martyn Woolford's right-wing free-kick - much to the disgust of Tykes manager Keith Hill.
Stead made no mistake, thumping the ball beyond Button's flying right hand and into the corner of the net.
Adomah might have added a third moments later, as confidence surged through the City side. It was Adomah who broke clear again soon after, this time finding Stead in the penalty area only for the City striker to be denied by a point-blank save by Button, who turned a fierce shot over his crossbar.
Stead might have added another when he shook off the attentions of McNulty, but the former Blackburn striker hesitated at the vital moment and the chance was gone.
City midfielder Neil Kilkenny tested Button with a thunderous shot as time ticked away, but it mattered not, and the full-time whistle brought a pitch invasion from the jubilant home supporters.
Full Time The final whistle goes and the game is over.
Yannick Bolasie fouled by Michael Tonge, the ref awards a free kick. Shot comes in from Yannick Bolasie from the free kick, blocked by Jimmy McNulty.
Stephen Foster concedes a free kick for a foul on Jon Stead. Free kick taken by Ryan McGivern.
Scott Wiseman challenges Martyn Woolford unfairly and gives away a free kick. Direct free kick taken by Neil Kilkenny.
Shot from just outside the box by Jim O'Brien goes over the bar.
Kallum Higginbotham crosses the ball.
The referee blows for offside. Liam Fontaine restarts play with the free kick.
Dean Gerken takes the free kick.
Booking Kallum Higginbotham is shown a yellow card.
Unfair challenge on Richard Foster by Kallum Higginbotham results in a free kick.
Neil Kilkenny takes a shot. David Button makes a save.
Substitution Reuben Noble-Lazarus joins the action as a substitute, replacing Craig Davies.
Substitution Lee Collins on for David Perkins.
Effort from deep inside the area by Ryan McGivern misses to the right of the goal.
Outswinging corner taken left-footed by Martyn Woolford from the left by-line.
Substitution Albert Adomah leaves the field to be replaced by Yannick Bolasie.
Jim O'Brien crosses the ball, Dean Gerken makes a comfortable save.
Albert Adomah is caught offside. Free kick taken by David Button.
The ball is crossed by Stephen Pearson, David Perkins manages to make a clearance. Corner taken by Neil Kilkenny from the right by-line to the near post, David Perkins makes a clearance.
The ball is crossed by Jim O'Brien, Ryan McGivern gets a block in. Outswinging corner taken right-footed by Kallum Higginbotham played to the near post, Jim O'Brien has a headed effort from close range and clears the bar.
Unfair challenge on Jim O'Brien by Ryan McGivern results in a free kick. Scott Wiseman crosses the ball in from the free kick, Ryan McGivern makes a clearance. Corner from the left by-line taken by Kallum Higginbotham, save by Dean Gerken.
Unfair challenge on Stephen Dawson by Stephen Pearson results in a free kick. Jimmy McNulty takes the free kick.
Free kick awarded for a foul by Neil Kilkenny on Stephen Dawson. Kallum Higginbotham crosses the ball from the free kick right-footed from right channel, save made by Dean Gerken.
Unfair challenge on Kallum Higginbotham by Andre Amougou results in a free kick. Kallum Higginbotham takes the free kick.
The ball is swung over by Jim O'Brien, save by Dean Gerken.
David Perkins sends in a cross.
Free kick awarded for an unfair challenge on Neil Kilkenny by Kallum Higginbotham. Stephen Pearson takes the free kick.
Kallum Higginbotham challenges Neil Kilkenny unfairly and gives away a free kick. Dean Gerken restarts play with the free kick.
Jon Stead takes a shot. David Button makes a save. Corner from the left by-line taken by Martyn Woolford, Andre Amougou takes a shot. Save by David Button.
Corner taken by Neil Kilkenny from the right by-line.
Shot from just outside the penalty box by Albert Adomah misses to the left of the target.
Inswinging corner taken left-footed by David Perkins played to the near post, Jon Stead makes a clearance.
Substitution Michael Tonge on for Nathan Doyle.
50:32 Goal scored
Goal! - Jon Stead - Bristol C 2 - 0 Barnsley Placed penalty scored by Jon Stead. Bristol City 2-0 Barnsley.
Booking Jimmy McNulty goes into the referee's book.
Foul by David Perkins on Albert Adomah, free kick awarded. Free kick crossed left-footed by Martyn Woolford, Penalty awarded for a foul by Jimmy McNulty on Ryan McGivern.
Jim O'Brien fouled by Martyn Woolford, the ref awards a free kick. Scott Wiseman takes the free kick.
The referee blows his whistle to start the second half.
Substitution Neil Kilkenny on for Chris Wood.
45:00 +2:16 Half time
Half Time The half-time whistle blows.
Jon Stead takes a shot. Jimmy McNulty gets a block in. Corner taken by Martyn Woolford from the left by-line, Close range shot by Andre Amougou goes over the bar.
The assistant referee flags for offside against Andy Gray. Liam Fontaine takes the direct free kick.
Substitution Cole Skuse leaves the field to be replaced by Louis Carey.
A cross is delivered by Jim O'Brien, Stephen Pearson makes a clearance.
Jon Stead takes a shot. Save by David Button.
A cross is delivered by Craig Davies.
The official flags Craig Davies offside. Dean Gerken takes the free kick.
The ball is sent over by Albert Adomah, clearance by Jimmy McNulty.
The referee blows for offside against Kallum Higginbotham. Andre Amougou takes the free kick.
The ball is sent over by Richard Foster, Jimmy McNulty makes a clearance.
Free kick awarded for an unfair challenge on Andre Amougou by Nathan Doyle. Dean Gerken takes the free kick.
A cross is delivered by Craig Davies.
The assistant referee flags for offside against Craig Davies. Dean Gerken takes the free kick.
The ball is delivered by Kallum Higginbotham, Stephen Foster produces a header from deep inside the six-yard box that clears the crossbar.
Outswinging corner taken from the right by-line by Jim O'Brien, clearance made by Andre Amougou.
Albert Adomah takes a shot. Save by David Button.
Jon Stead is caught offside. Free kick taken by David Button.
Centre by Scott Wiseman, clearance by Richard Foster. Inswinging corner taken right-footed by Kallum Higginbotham.
Stephen Dawson produces a right-footed shot from just outside the area that goes harmlessly over the target.
Nathan Doyle takes a shot. Liam Fontaine gets a block in. Corner taken by Kallum Higginbotham from the left by-line played to the near post, clearance made by Jon Stead.
Outswinging corner taken right-footed by Cole Skuse played to the near post, Nathan Doyle makes a clearance.
The ball is sent over by Jon Stead, clearance made by Stephen Foster.
Andy Gray is ruled offside. Dean Gerken restarts play with the free kick.
Assist on the goal came from Chris Wood.
10:55 Goal scored
Goal! - Cole Skuse - Bristol C 1 - 0 Barnsley Cole Skuse finds the net with a goal from inside the penalty box to the bottom left corner of the goal. Bristol City 1-0 Barnsley.
Stephen Dawson has a shot on goal from long range that goes wide left.
Unfair challenge on Jimmy McNulty by Jon Stead results in a free kick. Jimmy McNulty takes the direct free kick.
Kallum Higginbotham takes a shot. Dean Gerken makes a save. Inswinging corner taken left-footed by David Perkins played to the near post, clearance made by Jon Stead.
Martyn Woolford concedes a free kick for a foul on Scott Wiseman. Direct free kick taken by David Button.
Stephen Dawson is adjudged to have handled the ball. Dean Gerken takes the free kick.
Stephen Dawson challenges Cole Skuse unfairly and gives away a free kick. Direct free kick taken by Cole Skuse.
Unfair challenge on Scott Wiseman by Chris Wood results in a free kick. David Button restarts play with the free kick.
Unfair challenge on Albert Adomah by David Perkins results in a free kick. Cole Skuse takes the direct free kick.
Effort on goal by Nathan Doyle from long range goes harmlessly over the target.
The free kick is swung in left-footed by David Perkins, Liam Fontaine makes a clearance.
Booking The referee shows David Perkins a yellow card.
Unfair challenge on Jim O'Brien by Liam Fontaine results in a free kick.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.