The Cowboys fought their way back from an 18-6 halftime deficit to draw level at 18-18 after 63 minutes but the Bulldogs ran away with the win in the final few minutes.
After Krisnan Inu booted a penalty to break the deadlock, winger Sam Perrett crossed in the 76th minute and Barba went over for his third in the 78th minute to maintain the Bulldogs' spot at the top of the ladder.
Barba scored his 15th try of the year in the 13th minute when he burst onto a Josh Reynolds offload and raced 50m untouched after the Canterbury five-eighth had stepped his way through the Cowboys line.
North Queensland hit back in the 17th minute when Johnathan Thurston switched play left to the Cowboys' short side 10m out from the Canterbury line and Matt Bowen put through an angled kick for Kane Linnett to score.
Barba scored his second try of the night in almost identical fashion to his first when a James Graham pass from a scrum on the Bulldogs 20m line sent Josh Jackson upfield and he dished off to a flying Barba who raced 45m for a converted try and for the Dogs to regain the lead 12-6 after 29 minutes.
Six minutes later Inu outjumped Linnett chasing a Reynolds kick for a benefit-of-the-doubt try and, after the former Warrior converted, the Bulldogs had stretched their lead to 12.
The Cowboys opened the scoring in the second half eight minutes in when Antonio Winterstein chased through a Thurston kick that bounced away from Barba to close the gap to 18-12 with Thurston's conversion.
Matt Bowen produced a try saver on Brett Morris in the 53rd minute before Thurston dummied his way over from close range in the 62nd minute for his first try of 2012.
Thurston converted to tie the scores up at 18-18, but the Bulldogs didn't panic and duly sealed victory.