Match ends, Swansea City 1, Bristol City 3.
Kasey Palmer scored against former club Swansea City as Nigel Pearson won his first game in the Bristol City dugout.
Andre Ayew gave Swansea a deserved lead from the spot after Palmer, who was on loan at the Welsh side earlier this season, handled in the box.
Nahki Wells swiftly levelled with a sharp finish before Palmer scored straight from a corner.
Antoine Semenyo added a late third as Swansea lost a home league game for only the second time in 2020-21.
This was a shock to the system for Steve Cooper's team, who were beaten after going in front for the first time this season.
The Swans' automatic promotion hopes have been dented after a second defeat in three games leaves them fourth, four points adrift of the top two.
They were made to pay after failing to make their first-half dominance count, with mid-table Bristol City improving significantly after the break to claim a second successive victory.
Pearson had watched from the stands as his new team ended a seven-game losing streak by beating Middlesbrough on Tuesday, and he was at the Liberty Stadium 24 hours later to see Swansea grind out a win against Coventry.
Steve Cooper's team had to battle for three points in midweek, but were sharper from the outset here.
Pearson spent much of the first half either shouting or gesticulating at his new players as Swansea created a succession of opportunities.
First Jamal Lowe forced a very fine save from Dan Bentley, who then denied Yan Dhanda after Lowe's clever flick had put him in.
Conor Hourihane saw a 20-yard effort smothered before the Irishman's header from point-blank range was beaten away by Bentley.
Ben Cabango's effort was then hacked off the line by Adrian Mariappa as Swansea went in at the break wondering how they were not ahead.
Pearson changed his formation - and hauled off teenager Ryley Towler before half-time - in a bid to change the course of the contest, and his team had their first shot when Tyreeq Bakinson prodded over early in the second period.
Swansea broke through when the impressive Matt Grimes floated a ball towards Jake Bidwell and Palmer was adjudged to have handled.
Ayew converted from the spot for his 10th goal of the season - but the lead did not last long.
Zak Vyner, who began in defence but ended up in midfield thanks to Pearson's reshuffle, burst into space down the Swansea right and pulled back for to Wells to steer home his ninth of the campaign.
Palmer's curling corner then missed everyone including Swansea keeper Freddie Woodman and sailed in at the far post.
With the home side throwing men forward in stoppage time, substitute Semenyo charged down a Woodman clearance before tapping in from close range to bring the curtain down on Swansea's 13-game unbeaten home run in the league.
Swansea head coach Steve Cooper:
"Certainly first half I think the game should have been done and dusted - we should have had two or three goals at least. We didn't take our chances.
"We still managed to start the second half just as well - I mean complete dominance of the game.
"We went 1-0 up and then we didn't manage going 1-0 up very well, something we have done very well this year.
"Freddie's made a couple of mistakes for the second and third goal, we know that, but he has been brilliant since he came through the door. The first goal is the disappointing one because it was completely against the run of play.
"What we have got to do is just deal with whatever happens and look forward. It's quite painful now but I can't do anything other than regroup with the boys and get ready for the next one."
Bristol City manager Nigel Pearson:
"That looked unlikely in the first half. Swansea were by far the better side. They dominated possession and our quality on the ball was poor. We had to work so hard out of possession and it was a relentless task just to stay in the game.
"But I have to give the players an unbelievable amount of credit. They stuck to their task and put their bodies on their line.
"Let's not kid ourselves, we were second best. I couldn't have had any complaints if we had come in 2-0 or 3-0 down. But that just shows what football is like
"I've inherited a talented group of young players, but with a team ethic that shines through. I like that."
- 22LatibeaudiereSubstituted forWhittakerat 82'minutes
- 14HourihaneSubstituted forArriolaat 80'minutes
- 24BidwellBooked at 61mins
- 21DhandaSubstituted forFultonat 78'minutes
- 10A Ayew
- 45PalmerSubstituted forSemenyoat 88'minutesBooked at 90mins
- 4NagySubstituted forMassengoat 90+5'minutes
- 34TowlerBooked at 25minsSubstituted forS Sessegnonat 45+1'minutes
- 43S Sessegnon
- Keith Stroud
- Shots on Target
Second Half ends, Swansea City 1, Bristol City 3.
Antoine Semenyo (Bristol City) is shown the yellow card.
Foul by Connor Roberts (Swansea City).
Daniel Bentley (Bristol City) wins a free kick in the defensive half.
Goal! Swansea City 1, Bristol City 3. Antoine Semenyo (Bristol City) left footed shot from very close range to the bottom left corner.
Attempt missed. André Ayew (Swansea City) left footed shot from outside the box is close, but misses to the right. Assisted by Connor Roberts with a headed pass.
Substitution, Bristol City. Han-Noah Massengo replaces Ádám Nagy.
Attempt missed. Nahki Wells (Bristol City) right footed shot from the centre of the box is close, but misses to the right. Assisted by Antoine Semenyo with a through ball.
Attempt missed. André Ayew (Swansea City) left footed shot from the centre of the box misses to the left.
Foul by Marc Guehi (Swansea City).
Antoine Semenyo (Bristol City) wins a free kick on the right wing.
Substitution, Bristol City. Antoine Semenyo replaces Kasey Palmer.
Offside, Swansea City. Jake Bidwell tries a through ball, but André Ayew is caught offside.
Attempt missed. Tyreeq Bakinson (Bristol City) right footed shot from outside the box is too high. Assisted by Famara Diédhiou.
Attempt missed. Zak Vyner (Bristol City) right footed shot from outside the box is close, but misses to the left.
Attempt missed. Ben Cabango (Swansea City) header from the centre of the box is high and wide to the right. Assisted by Connor Roberts.
Morgan Whittaker (Swansea City) wins a free kick in the defensive half.
Foul by Steven Sessegnon (Bristol City).
Substitution, Swansea City. Morgan Whittaker replaces Joel Latibeaudiere.
- Gordon Ramsay's Bank Balance: Can contestants beat the balance board and walk away with £100,000?
- Lockdown and food: Why it causes emotional eating habits and how can we manage them?