Cameron Burgess then produced a heroic showing with a goal line clearance after a mistake at the back had Riis looking to shoot into an open goal.
It created a period of madness, which eventually led to a second goal for Bristol City. Mehmeti’s ball across the back post is volleyed powerfully into the back of the net by Riis.
Just seconds before the half-time whistle, Key is denied by Bristol duo Ross McCrorie and and Vitek from close range. A big let-off for the hosts.
A lively start from the Swans in the second period. There were chances for Burgess and Cullen from inside the six-yard box whilst Galbraith fashioned a powerful strike wide.
Despite trailing by two goals, Swansea were having the better of the proceedings in the hosts’ half. Eom was denied a chance inside the area as Zak Vyner blocked the south Korean’s effort, and Galbraith tried his luck once again from distance only for it to go wide.
There were penalty shouts for Bristol beyond the hour mark as Borges was brought down in the box, but Josh Smith waved any appeals away.
It should have been three for the Robins, and a fantastic save from Vigouroux was the saving grace for Swansea as he turned a Sinclair Armstrong effort past the post for a corner kick.
And it got worse for Swansea with less than 10 minutes remaining. Substitute Hirakawa played in behind by in-form Mehmeti, drove forward alone and dispatched the ball into the bottom left corner to all but seal the three points.
Swansea City: Lawrence Vigouroux, Josh Key (Jay Fulton 77), Marko Stamenic (Goncalo Franco 65), Jisung Eom (Zeidane Inoussa 65), Cameron Burgess (captain), Ishe Samuels-Smith (Ricardo Santos 68), Liam Cullen (Zan Vipotnik 65), Kaelan Casey, Ethan Galbraith, Adam Idah, Ronald.
Substitutes: Andy Fisher, Melker Widell, Malick Yalcouye, Manuel Benson.
Bristol City: Radek Vitek, Ross McCrorie (Mark Sykes 58), Adam Randell, Scott Twine (Yu Hirakawa 71), Anis Mehmeti, Zak Vyner, Rob Dickie (captain), Emil Riis (Jason Knight 58), George Tanner, Neto Borges (Haydon Roberts 72), Sinclair Armstrong (Fally Mayulu 84)
Substitutes: Max O’Leary, Cameron Pring, Elijah Morrison, Olly Thomas.
Referee: Josh Smith