Agassi made the comments in an interview with Singapore newspaper Straits Times, saying Nadal's achievements are more impressive because he has had to deal with tougher competition.
Federer has 17 Grand Slam titles to Nadal's 13, although the Spaniard leads his Swiss rival 23-10 in head-to-head meetings.
Agassi is quoted as saying that "I'd put Nadal No. 1, Federer No. 2," adding that "it's just remarkable to me what he has done, and he has done it all during Federer's prime."
"Nadal had to deal with Federer, [Novak] Djokovic, [Andy] Murray in the golden age of tennis," said Agassi, himself a former world No. 1. "He has done what he has done, and he's not done yet."