Newcastle, among the pre-season favourites for relegation, climbed to third place in the table and remain unbeaten after 10 matches.
French-born Senegalese striker Ba headed home Gabriel Obertan's teasing cross from close range after 12 minutes and he doubled the away side's lead with another neat finish five minutes before halft-ime.
Ba gave away a penalty with a clumsy foul on Peter Crouch and Jon Walters converted the spot-kick to give Stoke hope with 15 minutes remaining.
Ba, however, quickly made amends when he coolly dispatched a penalty, his eighth goal of the season, after Robert Huth was adjudged to have shoved Leon Best in the area.
"I'm a bit disappointed that we didn't play the way we should have in the second half but we defended well and you don't get to 22 points without showing different sides to your game," Newcastle manager Alan Pardew told Sky Sports.
"All the big sides have been here and not won so that just shows how good Stoke are. They are a top team and will finish top 10."
Newcastle climbed above Chelsea into third place, one point behind Manchester United and six adrift of leaders Manchester City. Stoke remained 11th in the standings.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.