Nadal, whose knees kept him out of Wimbledon, returned to Grand Slam play with a 6-2, 6-2, 6-3 win over Richard Gasquet, while Safin, a former world No. 1, closed out his Grand Slam career, losing to Jurgen Melzer 1-6, 6-4, 6-3, 6-4.
The top-seeded Federer beat 65th-ranked Simon Greul of Germany 6-3, 7-5, 7-5 before a night session-record crowd of 24,206.
Wednesday's action was Nadal's first match at a major tournament since he was upset in the fourth round of the French Open on May 31. The six-time Grand Slam champion then skipped Wimbledon, deciding not to defend his title there because of tendinitis in both knees.
"I don't have pain, so I don't think," Nadal said about his six-week absence.
The layoff led to Nadal's drop in the rankings from No. 1 to No. 3.
He appeared to be moving well against Gasquet, who recently came off a 2½-month suspension for testing positive for cocaine. Gasquet appealed what would have been a longer ban, saying the drug entered his system when he kissed a woman at a nightclub.
Nadal, whose style of wearing down opponents under the weight of his groundstrokes has seemed to take a toll on him at end of long tennis seasons, is hoping this could be the year he completes a career Grand Slam by winning his first U.S. Open.
"I am more fresh, yeah. Fresher than ever in this tournament. I don't know if this kind of fresh is good," he said. "No excuses about being very tired."
Still, Nadal finds it amusing that there has been so much discussion about his knees and his time away from the tour.
"Seems like I was two years outside of competition," he said. "It was two months."
Nadal surprised himself by reaching the quarterfinals in Montreal and semifinals in Cincinnati.
"I am very happy to be here another time, and I am enjoying much more practicing with a better attitude than when I was playing in clay season with pain in the knees every day. I went on court without pressure," he said about returning to the sunny National Tennis Center, where he reached the semifinals last year before falling to Andy Murray.
"Just thinking I feel I'm a very lucky guy to be here playing and enjoying this sport," he said.
Gasquet, for one, was impressed.
"He can win the tournament," said Gasquet, a 2007 Wimbledon semifinalist and former top 10 player. "Day after day, he will improve his level. For sure, he can win."
Federer is trying to become the first man since Bill Tilden in the 1920s to win the American Grand Slam tournament six years in a row.
The 28-year-old Greul squandered two set points in the second set and a 3-0 lead in the third, eventually succumbing to Federer's punishing groundstrokes.
"I thought, with a little bit of luck, I could win one set," Greul said. "But it didn't happen. He was playing too well."
Federer had the decisive third-set break against the German in the 11th game to take a 6-5 lead. Greul wasted yet another break point on Federer's serve before the Swiss closed out the match with his eighth ace.
"I saw him play a couple of times, he played really, really well," Federer said in a courtside interview. "I knew I could be in for a battle. I thought the level was really high. There was
a lot of intensity."
Federer has won 13 consecutive matches against Hewitt, including victories over the Australian in the 2004 final and 2005 semifinals at Flushing Meadows.
"I'm intrigued about this matchup. It's an incredible run for me against him. I cannot believe I've beaten him that many times in a row," Federer said. "But we had some close ones during those 13. Everyone starts from zero, unfortunately for me now. I hope I can win again."
The Swiss star -- owner of a record 15 Grand Slam singles titles overall -- hasn't lost at the U.S. Open since a fourth-round setback against David Nalbandian in 2003.
"But on any given day, a former world No. 1, a guy who's won majors, is very, very dangerous," Federer said, looking ahead to playing Hewitt. "That's why I have to make sure I get into the match quickly, not give him the lead, because we know he's not going to go down without a fight. He's physically almost as tough as anyone out there."
Hewitt was asked whether he thinks hard courts might be the best surface on which to end his losing streak against Federer.
"Obviously, this surface, he's been hard to beat for anyone," Hewitt said. "Yeah, it's probably hard to probably nominate the best surface against him."
The 29-year-old Safin won the 2005 Australian Open and reached No. 1 in the ATP rankings -- a spot his younger sister, Dinara Safina, currently holds in the WTA rankings.
He came into the U.S. Open ranked 58th and with a 12-17 record this season. Safin also lost in the first round at Wimbledon in June.
The Russian has said this will be his last year on tour.
"It's OK. It's the end. So, just, it's the last one. Could have been better ending, but still OK," Safin said. "I don't care about losses anymore."
It's a fitting site for his finale: Safin burst onto the scene by upsetting Pete Sampras to win the 2000 U.S. Open.
He called that victory "just a miracle for me."
"I really didn't believe I could get anywhere closer to the final of a Grand Slam. And then, after beating Sampras, I never really understood what happened," Safin said. "It was difficult, because I was 20 years old. I wasn't ready for this, so it's really difficult to understand it. ... I wasn't prepared."
Now he's 29 and wants to move to the next chapter of his career, though he concedes he's not sure what, exactly, that will be. Watching his top-ranked sister probably won't be a big part of it.
"I really love my sister, but I think she can manage without me," he said.
He leaves behind a lot of good memories. He was a fiery, emotional player in a sport that doesn't have many -- a player who estimated he's broken more than 300 rackets in his career and also got fined for pulling his pants down once during a French Open match.
As Melzer put it: "I don't watch a lot of tennis; I have a lot of tennis in my life. But when Marat played, I sat down and watched, because it was something you don't see from the other players."
Will Safin miss tennis as much as tennis misses him?
"I need to get away from tennis for some time to realize what I'll miss," he said. "Right now, it's difficult to decide exactly what I'll miss."
Safin grew weary this year of speaking about his retirement.
"It's too many questions about what I'm going to do, why I'm retiring and this and that. So I answer the same question, I don't know, a thousand times. Just go on Google, and you have the same answer," he said Wednesday. "But it's OK. Few tournaments to go, so I can manage."
The plan is to wrap things up at the Paris Masters in November. As for what comes after that, Safin won't say -- other than that he wants to get away from the world of tennis.
"I'm different than another person who wants to lay back and do nothing for rest of the life and talk nonsense on ESPN, talk about my match against Sampras," Safin said. "I will not do that. I want to achieve something else."
When asked about being the opponent in Safin's Grand Slam goodbye, Melzer used the phrase, "if he really retires."
Why the word "if"?
"With Marat," Melzer said, "you never know."
Other winners Wednesday were No. 6 Juan Martin del Potro, No. 9 Gilles Simon, No. 13 Gael Monfils, No. 18 David Ferrer, No. 32 Nicolas Almagro and No. 24 Juan Carlos Ferrero, who beat 36-year-old Fabrice Santoro, appearing in his record 69th major tournament, 6-4, 6-3, 6-3.
Information from The Associated Press and Reuters was used in this report.