Williams' victory, her fourth tournament success of 2013 and only the seventh on clay since she turned pro in 1995, prevented Sharapova from leapfrogging her to the top of the rankings.
The Russian world number two, struggled to find her range on the sun-drenched Manolo Santana show court as the 31-year-old Williams raced through the first set.
Sharapova, 26, mounted a fightback at the start of the second but could not sustain it and Williams broke her for a fifth time in the match to secure a first title on red clay - the Madrid courts were blue last year - since the 2002 French Open.
Sharapova, who won the title at Roland Garros last year, has a woeful record against Williams. She has only beaten her twice in 15 attempts, and never on clay, with both victories coming almost a decade ago.