The Belarusian wrapped up the first set to love in just 25 minutes as an unusually sluggish Barty struggled to find any kind of rhythm to her game.
The 25-year-old Australian, who had won 16 consecutive matches on red clay, rallied in the second set to get herself back on level terms.
At 4-4 in the deciding set Sabalenka broke Barty and then held her nerve on serve to secure her 10th WTA Tour career title which will see her climb up to No.4 from No.7 in the world rankings on Monday.
Barty was on a streak of nine consecutive WTA Tour titles and had not lost to an opponent in the top 10 since the WTA Finals in 2019.
But in-form Sabalenka had not dropped a single set in Madrid in the lead-up to the final and began in imperious fashion.
The 23-year-old from Belarus produced a clinical first set, dropping just four points, as Barty failed to win a single game in the set to record a bagel for the first time in four years.
The pair exchanged breaks in the second set before Barty finally discovered some momentum to break her opponent again to seal the set.
Sabalenka squandered a one-set lead to lose to Barty in the Stuttgart Open final two weeks ago.
Barty, also playing in the final of the tournament for the first time, had threatened to break her opponent at 4-3 in the decider.
But this time Sabalenka took her chance when Barty fluffed a drop shot and then double faulted to give her three break points, converting at the first time of asking with a powerful backhand.
Sabalenka then clinically sealed victory with a flawless service game to love, clinching victory when Barty smashed a forehand into the net.
"To be honest, after the final in Stuttgart I was injured, I couldn't move and wanted to withdraw," Sabalenka said after the win.
"But the recovery was good, in four days I feel better and now I'm the champion. It's been an amazing week."