Cardiff had raced into a 14-0 lead in as many minutes with George Watkins and Rory Watts-Jones snatching a try each. Outside half Dean Gunter converted both to give the home side a handy lead.
But Newport, with just one victory to their name this season, dug deep and an Owen Broad try and two Geraint O’Driscoll penalties meant the sides headed in at half-time with the deficit reduced to a mere six points at 17-11.
The second half provided relatively few talking points, with an impressive 50 metre penalty for Matt O’Brien being the only score.
The victory means Cardiff move up to third, level on points with Carmarthen Quins, with Newport in ninth place.