Nishikori was leading 6-4, 6-1 when the 48th-ranked Andujar suddenly came to the net. Tournament officials did not immediately detail the nature of the Spaniard's injury.
''It's unfortunate for Pablo today, but I have been playing well ... had good two sets,'' Nishikori said.
The 24-year-old Nishikori, who has never made it past the fourth round in five previous U.S. Open appearances, has been battling an injury of his own in recent weeks. A severely infected right big toe forced him to miss tuneup events leading up to Flushing Meadows.
Nishikori next faces the winner of 23rd-seeded Leonardo Mayer and Matthew Ebden.