Sunday's win also means that Nadal has now won 30 ATP Masters 1000 Series titles in his long career, more than anyone who is currently playing, reports Xinhua news agency.
The first set saw Thiem try and adopt an attacking attitude against Nadal, who had only recently defeated him in Barcelona.
That attitude saw him take an early service break to silence the partisan crowd in Madrid, but Nadal was able to break back in the sixth game as Thiem paid for his aggression with too many unforced errors.
The first set went to a tie break in which Nadal always looked to be on top, but it was not until the fifth time of asking that he was able to win the decisive point.
Nadal then broke immediately at the start of the second set and the games went with serve until the ninth game when Nadal had two Championship points on Thiem's serve.
However, the Austrian battled back bravely and saved them both before serving out the game.
He also showed courage in the final game of the match, forcing four break points on Nadal's serve as both players gave everything, until Nadal finally claimed the title at the fourth time of asking.