Loic Remy was the hero for Newcastle with two goals in the first half to make it five in five games since his loan move from Queens Park Rangers.
Peter Odemwingie pulled a goal back for Cardiff early in the second half, but Newcastle held on for all three points to bounce back from two successive defeats in the Premier League.
Newcastle had a lucky escape after just four minutes when Fraizer Campbell got to a long ball before goalkeeper Tim Krul and rounded the keeper only to lose his footing just as he was about to shoot.
David Marshall denied Newcastle the opener on 18 minutes when he produced a superb reaction save to keep out Remy's close-range effort and Andrew Taylor was alert to block Papiss Cisse's goalbound follow-up.
A minute later Marshall came to Cardiff's rescue once again when he produced a flying save to tip over Moussa Sissoko's fizzing long-range effort from the edge of the box.
Newcastle were looking dangerous every time they went forward and Remy should have done better on 26 minutes when Yohan Cabaye played in Mathieu Debuchy down the right and he cut the ball back for Remy who could only fire his tame shot straight into the arms of Marshall.
Newcastle deservedly broke the deadlock on the half-hour mark as Remy picked up a ball from just past the halfway line and cut inside past a couple of Cardiff challenges before drilling his shot into the bottom corner.
The visitors doubled the lead on 38 minutes when Remy reacted quickest to steer home from the edge of the box after Marshall had beaten out Cisse's shot from Cabaye's superb through ball.
Three minutes before the break the impressive Cabaye almost caught Marshall out with a free-kick from out wide on the right. With everyone expecting Cabaye to cross the ball into the box the Frenchman fired in shot from an acute angle and was unlucky to see it come back off the post with Marshall well beaten.
Cardiff got themselves back into the game just before the hour mark when substitute Jordan Mutch fed Odemwingie inside the box with a clever pass and the striker took the ball round Krul before firing into the net.
The home side came close to drawing level two minutes later when Campbell found space inside the box and fired over a shot right across the face of goal which Aron Gunnarsson just failed to get on the end of.
Newcastle almost caught Cardiff on the break soon after when Remy played in Sissoko, but his left-foot shot was kept out by the feet of Marshall.
Marshall made a fine save from Cisse late on to keep Cardiff in the game and Newcastle had strong claims for a penalty waved away in the closing minutes when Taylor appeared to handle inside the box, but it did not matter in the end as Newcastle held on to take all three points.