American Tiafoe thrilled the home crowd with a 6-4 4-6 6-4 6-3 win over four-time US open champion Nadal in New York on Monday.
The defeat ended the Spaniard's bid for a record-extending 23rd major singles title.
Nadal led the fourth set 3-1 before Tiafoe hit back, winning five games in a row to secure his quarter-final spot.
Tiafoe, seeded 22nd, threw his racquet to the floor and covered his face in disbelief as his victory was confirmed by a netted Nadal backhand.
BD-pratidin/Ishrar Tabassum