Federer, trying to equal Sampras' record, sobbed at the trophy presentation.
"Maybe I'll try later. God, it's killing me," Federer said, crying. He returned to congratulate Nadal within minutes, saying: "You deserved it. You played a fantastic final."
Top-ranked Nadal, who has won five of the seven Grand Slam finals they've contested, now has a major on hard courts to go with his titles on clay and grass.
He's the only man capable of a Grand Slam this season, 40 years after Australian great Rod Laver last won all four majors in one season.
"Roger, sorry for today. I really know how you feel right now," Nadal said. "Remember, you're a great champion, you're one of the best in history. You're going to improve on the 14 of Sampras."
Nadal collected the trophy from Laver, on the court that was named in the great Australian's honor, and put his arm around Federer.
"To receive this trophy from Rod Laver is a dream for me," he said. "Rod, thanks very much. It was an amazing two weeks for me."
Nadal advanced to the final after holding off fellow Spanish left-hander Fernando Verdasco on Friday in 5 hours, 14 minutes - the longest match in the tournament's history.
Federer had a straight-sets win over Andy Roddick the previous night, but said the difference in preparation had no influence on the final.
He said the fact he'd missed the Sampras record at a tournament he's won three times didn't make the loss any worse or easier to take.
"Honestly, no," he said. "I mean, it's more like, in the first moment you're disappointed, you're shocked, you're sad, you know, then all of a sudden it overwhelms you.
"The problem is you can't go in the locker room and just take it easy and take a cold shower. You're stuck out there. It's the worst feeling. ... it's rough."
Federer, so dominant when he won three of the four majors in 2006 and 2007, has now lost finals on three different surfaces to Nadal.
He hasn't given up hope of beating the 22-year-old Spaniard.
"For sure," he said. "I didn't spend 4¼ hours out there (not) believing it."
Nadal has four consecutive titles on clay at Roland Garros and beat Federer on grass in a five-set epic at Wimbledon last year.
He is 13-6 overall against Federer and ended the Swiss star's 237-week streak at No. 1 last year after claiming the Beijing Olympic gold medal.
Federer, who turned around that season with a U.S. Open title, saved two championship points from 15-40 in the eighth game of the fifth set but sent a forehand long on the third match point.
Nadal flopped onto his back, then got up and raced to shake hands.
The players put their arms around the other's shoulders at the net as they walked off the court.
Although Federer actually won one more point - 174-173 - his serve let him down all too frequently. He connected on only 51 percent of his first serves, and it seemed as if all of his six double-faults came at critical times.
And as the pressure ratcheted up in the fifth set, it was Federer who wilted, not Nadal. Federer had six winners and 14 unforced errors in the set, while Nadal had just two unforced errors and dropped only three points in four service games.
Federer was only able to convert 6 of 19 breakpoint chances.
Nadal converted 7 of 16.
Both players started tight, committing uncharacteristic errors.
Knowing that weak shots would be punished, they were pushing the limits.
They exchanged service breaks in the first two games. Normally calm on court, Federer pumped his fist after breaking for a 4-2 lead only to double-fault when facing break point in the next game.
Nadal got the key break with Federer serving at 5-5. The crowd was stunned when the Swiss smacked a forehand wide on an easy short ball to make it 15-40, and Nadal followed with a forehand passing shot winner, then held for the set.
With Nadal seemingly getting to everything and ripping winners, Federer was looking tentative and hesitating to charge the net.
But he started putting winners together and cutting his mistakes in the second set. After Nadal broke for a 4-3 lead, Federer broke the Spaniard's next two service games, taking a 5-3 lead after converting his fifth break point of the game. He then held to take the set.
Then the match intensified.
Amid a series of rallies lasting more than 20 shots, Nadal saved six break points in his last two service games in the third set, and Federer fended off a set point while serving at 5-6.
A lunging backhand volley winner gave Nadal a 6-3 lead in the tiebreaker, earning him chants of "Rafa!" and Federer double-faulted.
Federer saved five break points while serving at 2-2 in the fourth set, then broke Nadal in the next game for a 4-2 edge.
He closed with a service winner to even it at two sets apiece.
Nadal broke Federer for a 3-1 lead and the clock ticked past midnight in the next game, taking the tournament into a third week.
It was the first Australian Open men's final to go to five sets since Mats Wilander beat Pat Cash in 1988, the first at Melbourne Park.