The win denied Federer the chance to equal Pete Sampras's record of 14 Grand Slam titles and leaves world number two Nadal as the holder of three of the four majors as well as the Olympic gold medal.
"For me to receive this trophy from Rod Laver is a dream for me," Nadal said. "It was an amazing two weeks for me."
"Roger, sorry for today. I really know how you feel right now. It's really tough (but) remember you are a great champion, one of the best in history and you have proved that."
Federer made an unusually nervy start, over-hitting two backhands and even throwing in a double fault before running round the ball to hit a forehand and shanking it well wide to gift Nadal the early break.
But Federer had recovered by the second game and broke back immediately, wrong-footing Nadal with a forehand winner down the line.
The pair traded two service holds apiece before Federer grabbed his second break of the match with a forehand return of serve winner down the line.
But Nadal broke back straight away, setting up the break with an angled backhand cross court winner before Federer double faulted to gift the Spaniard the game.
Nadal then broke again in the 11th game of the set with a forehand passing shot winner down the line before serving out the set with a forehand winner.
The second set went with serve until the fifth game when, again, it was Nadal who took the initiative, breaking when Federer hit into the net.
But again Federer broke straight back, when Nadal slapped a forehand long, before breaking again in the eighth game, at the fifth attempt, when Nadal hit a forehand into the net.
Federer then quickly served out the set, when Nadal sent a second serve return well beyond the baseline, and levelled up the match.
The third set went with serve throughout, although Federer squandered break points in the ninth and 11th games before holding in the 12th to cement the tie-break.
Nadal dropped the first point of the breaker but quickly recovered and eased through before sealing the two sets to one lead when Federer hit the top of the net with a second serve and watched as it bounced long.
But an increasingly weary Nadal was broken in the second game of the fourth set and, although he broke back immediately as well as holding five break points in the fifth game, he could do nothing to stop Federer from breaking again in the seventh game to take a 4-2 lead.
Federer then served out the set with ease, when Nadal failed to find the court on a return of serve, to force the decisive fifth set.
But somehow Nadal seemed to find an extra reserve of energy at the beginning of the final set, breaking in the fourth game when Federer hit a series of backhand errors.
From there Federer looked beaten and Nadal raced through to a 5-2 lead by posting his first two love service games of the match.
Federer did manage to recover enough to save two match points while serving to stay in the match, forcing Nadal to hit out on two consecutive points.
But the world number two had nothing left in the tank and pushed a forehand long behind the baseline to hand Nadal victory after four hours and 22 minutes.