The Australian player clicked into gear for the final's second set, which she won in just 20 minutes, with Sabalenka taking a medical timeout ahead of the third.
Sabalenka emerged with a bandage around her right thigh and couldn't prevent Barty from going on to claim her 11th career title.
It was the third straight come-from-behind win for Barty, who celebrated her 25th birthday by playing three sets against Elina Svitolina in Saturday's semifinals. Barty also won in three sets against Karolina Pliskova in the quarterfinals.
Barty and Jennifer Brady faced Desirae Krawczyk and Bethanie Mattek-Sands in the doubles final later Sunday. Barty is trying to become the first player to win both the singles and doubles titles at Stuttgart since Lindsay Davenport 20 years ago.
Barty saved eight of the 10 break points she faced against Sabalenka, converting five of the 12 opportunities she created to win in 1 hour, 47 minutes.
Sabalenka, 22, who defeated Simona Halep to reach the final, had been going for her first career title.