The Senegal striker headed in Gabriel Obertan's cross to open the scoring on 12 minutes and followed it up with a close-range finish before half-time.
Ba almost ruined his evening when his push on Peter Crouch led to Jonathan Walters' penalty with 15 minutes left.
But soon afterwards Ba scored from the spot following a foul on Leon Best.
It was his second hat-trick of the season and lifted his season's tally to eight, while victory for Alan Pardew's team puts them above Chelsea in the Premier League table with 22 points.
The result also marked a significant scalp given that Stoke - who almost signed Ba before he moved to former club West Ham - had not lost at the Britannia Stadium this season.
And it underlined the Magpies' credentials as the side with the best defensive record in the top tier, as they thwarted Stoke's set-piece threat.
The visitors combined that with the ability to break forward down either flank and Yohan Cabaye was also a source of creativity, playing alongside Danny Guthrie in the centre of Newcastle's midfield.
It was Obertan's anticipation that led to Ba's first goal. He was quickest to latch onto Best's flick-on down the right, and his accurate centre found the former Hoffenheim striker in space to head in his sixth goal of the season.
Stoke were reduced to set-piece efforts but the Newcastle defence lapped it up and, although he almost dropped a cross into Peter Crouch's path, Tim Krul saved well from Matthew Etherington's rising effort.
Tony Pulis's defence were not helped by the enforced substitutions of Ryan Shawcross and Marc Wilson, and keeper Asmir Begovic had to be sharp off his line to prevent further quick breaks by Newcastle.
Bizarrely, the home supporters booed Ba after his goal, although it was Stoke who decided not to sign him because of a supposed injury, and the jeers grew in volume when Ba doubled the lead.
Fabricio Coloccini, who was also excellent in defence, strode forward and when his angled pass into the area was not cleared, Best's cross-shot fell perfectly for Ba to tuck in from close range.
Newcastle easily withstood Stoke's direct approach in the first half, but they came under more pressure after the break, with Robert Huth heading over from Etherington's corner.
Pulis brought on Kenwyne Jones as his team altered their formation, and the change gave them the momentum which led to Walters' 75th-minute penalty, when Ba knocked over Crouch following a scramble.
Stoke had their tails up and the home crowd were in full voice, but just as they started to sense an equaliser, referee Mike Dean awarded a penalty at the other end for what looked like a tame push on Best by Huth.
Ba took little notice of the controversy and swept in his hat-trick goal to put Newcastle in a league position some of their supporters would have thought barely possible at the start of the season.