She hurt the knee in the opener, but if she was still in pain in the second round, her opponent couldn't tell.
"She was moving like a cat," Mattek-Sands said.
While Williams advances to the third round, Safin's Grand Slam career is over.
Planning to retire at season's end, the former world No. 1 fell 1-6, 6-4, 6-3, 6-4 to Austria's Jurgen Melzer. Safin's career will end with two Grand Slam titles, a smaller number than many experts thought possible when he broke through by beating Pete Sampras in the 2000 U.S. Open final.
"That match was a miracle for me," Safin said. "It took some time for me to see how big this thing was. It was difficult because I was also 20 years old, I wasn't ready for this. It was difficult to understand it."
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, Dinara Safina, 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.
Will he 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."
Playing in the afternoon in Arthur Ashe Stadium was Rafael Nadal, the 2008 French Open and Wimbledon champion, who is making his Grand Slam return after skipping this year's Wimbledon with knee tendinitis. His match was against Frenchman Richard Gasquet, who is coming back from a 2½-month suspension after testing positive for cocaine.
Defending champions Serena Williams and Roger Federer were scheduled for night matches.
Also losing Wednesday was two-time major champion Amelie Mauresmo, who fell 6-4, 6-0 to Aleksandra Wozniak. Mauresmo recently turned 30 and is also thinking about retirement, though she won't commit to a decision.
"The thing I don't want to do is make the decision to stop and then after two, six, eight months think, it was not quite the time yet," Mauresmo said. "Because then it's too hard, I would say, probably to make a comeback as Kim is making now, given the age."
Kim Clijsters, who came back to the U.S. Open after a long break with an easy win Monday, had a second-round match Wednesday afternoon against 14th-seeded Marion Bartoli.
Other seeded winners from early action Wednesday were men's No. 13 Gael Monfils and No. 24 Juan Carlos Ferrero, and women's No. 7 Vera Zvonareva, No. 18 Li Na and No. 31 Elena Vesnina. No. 10 Flavia Pennetta also won 6-0, 6-0 over Sania Mirza - the first double-bagel of this year's tournament.