The third seed produced her best tennis in the decider after edging the first set and being pegged back in the second by 14th seed Mladenovic, who was playing in her first final at premier mandatory level, the grade immediately below grand-slam tournaments.
Romanian Halep was playing in her third Madrid final in four years, having lost the 2014 showpiece to Maria Sharapova, and her victory made her the second woman to retain the title after Serena Williams in 2013.
Eugenie Bouchard through to Madrid Open quarters after Angelique Kerber retires
Halep took an even first set but grew frustrated in the second as Mladenovic came roaring back and the Romanian was given a code violation for throwing her racket in frustration in the direction of a ball boy at 30-0 down in the 12th game.
Mladenovic got off to a strong start in the tie-break and took the second set after winning two long rallies. But she had expended most of her energy and could not keep up with Halep, who served out the match in style by winning the game to love. (Reporting by Richard Martin,; Editing by Neville Dalton)
Bouchard reveals inspiration behind grudge-match victory over Sharapova
Bouchard wins Sharapova grudge match after 'cheater' claim