Two months after he lost to Sergiy Stakhovsky in the second round at Wimbledon, Federer was beaten 7-6 (7/3) 6-3 6-4 by a man he had not lost to in 10 previous meetings.
The defeat continues a miserable season for the 32-year-old from Switzerland, who has dropped from world number one to number seven in less than 12 months.
It also means there will be no first meeting at Flushing Meadows between Federer and Rafael Nadal, who were seeded to meet in the quarter-finals.
Robredo had to save set points to avoid being taken to a decider by British qualifier Dan Evans on Saturday night but he was simply too solid against an error-prone Federer.
How much difference a late change of court made will never be known, but Federer never looked comfortable with his movement in humid conditions.
A long rain delay prompted US Open organisers to move the match from Arthur Ashe to Louis Armstrong, a court Federer had not played a match on for seven years.
Robredo was a break ahead twice in the opening set and, although Federer pushed him to a tie-break, it was dominated by the Spaniard.
The Swiss was making odd tactical decisions, rushing to the net at the wrong moments and making too many unforced errors.
Robredo, 31, had won only three sets against Federer in all their previous matches, and never the first one.
Things really began to get exciting for the 19th seed when he broke for a 5-3 lead in the second set and then saved two break points to clinch it.
Federer's break-point conversion rate of two from 16 for the match was simply not good enough, and it was to cost him again in the fourth game of the third set.
The Swiss had 0-40 and five break points in total but made four unforced errors, his lack of confidence obvious for the packed stands to see.
The crowd tried to inspire Federer to a fightback but it was Robredo who gained the crucial advantage with a break for 4-3, and he clinched the biggest win of his life with a serve that his opponent could only get his frame on.
It has been an extraordinary year for the Spaniard, who was ranked 471st when he came back from thigh surgery last spring.
At the French Open Robredo won three consecutive matches from two sets to love down on his way to the quarter-finals.