Dogged Rovers took the lead in the 22nd minute through Enoch Showunmi and looked like creating a surprise.
But Cedric van der Gun and Scott Sinclair scored within a minute of each other and Shefki Kuqi netted a third in stoppage time.
Showunmi fastened on to a long punt upfield and netted for the League One side with an excellent angled volley.
City, who started with only four from Saturday’s Championship line-up, threatened just once in the first half, with Joe Collister hanging on well to a strike by Joe Allen.
Allen should have made it 1-1 two minutes after the break but his shot was turned over by Collister. Then Kuqi headed wide.
City enjoyed the lion’s share of possession but failed to make full use of it until a telling 60 seconds after Stephen Dobie and Sinclair had joined the action.
Ian Goodison and Max Blanchard were excellent in a compact Tranmere rearguard which paid dearly in the end for a brief period of slackness.
Van der Gun scrambled the ball home in the 74th minute when an Andrea Orlandi strike rebounded from the bar.
Then almost straight from the re-start Sinclair rounded two defenders and beat Collister with a left foot hit from twelve yards.
A third Swansea goal in stoppage time from Kuqi made the scoreline tough on the Merseysiders.