Ferrer's stunning victory over the French Open champion earned him a quarter-final showdown against 20th seed Juan Ignacio Chela of Argentina.
Relying on a devastating forehand that produced 22 winners, Ferrer won the third-set tiebreaker 7-4 before racing through the final set to end the three-hour, 28-minute slugfest at 1:50 a.m. local time on Arthur Ashe Stadium court.
The 25-year-old Ferrer, who had lost his previous four matches against Nadal, clinched victory on his second match point when the world number two's attempted backhand lob landed beyond the baseline.
Nadal, who has been hampered by a knee injury, battled gamely but the 21-year-old was undone by his fellow Spaniard's heavy forehand groundstrokes.
Ferrer, who beat Argentine David Nalbandian in five sets in the third round, blasted 48 winners in all and matched his best previous grand slam result -- a quarter-finals appearance at the 2005 French Open.