A goal just before the hour-mark by Jordi Gomez settled this fiercely-fought derby which saw Stephen McPhail sent off late in the game.
The Bluebirds had the first strike on goal when a Paul Parry cross was headed on to the roof of the net by McPhail.
Joe Ledley was booked in the sixth minute for a late tackle on Leon Britton and two minutes later, Dorus de Vries dropped a long throw from Miguel Comminges but the ball went behind for a goal-kick.
In the 18th minute both captains were spoken to by referee Alan Wiley as the challenges grew ever tougher.
Midway through the half a McPhail free-kick was headed just wide by Roger Johnson.
Cardiff kept up the pressure and Jay Bothroyd had a shot pushed away by de Vries, but no-one was on hand to tap home.
The Bluebirds made a change at the interval with leading scorer Ross McCormack replacing a very poor Eddie Johnson.
There were shouts for a penalty as Johnson tackled Jason Scotland deep in the Cardiff area early in the second half but referee Wiley waved play on.
Swansea took the lead when McPhail fouled Mark Gower on the edge of the area.
Gomez took the kick and it went through the wall into the corner of the net.
The Swans turned up the tempo even more and the Bluebirds were back-pedalling as Britton and Ferrie Bodde sprayed passes all over the field.
In the 74th minute McPhail committed a foul too many to receive a second yellow card and left the Bluebirds with 10 men for the final 15 minutes.
Bothroyd did find the net three minutes later but a flag was already raised for offside.
Swansea had chances to increase the score but thoroughly deserved their victory.