Ferrer dropped the middle set but came away with a 7-6 (7-5), 3-6, 6-4 victory in a match that lasted 2 hours, 42 minutes and required three match points in the final set.
Switzerland's Roger Federer, the No. 5 seed, had an easier time with a straight-set 6-3, 7-6 (9-7) win over Philipp Kohlschreiber of Germany. Federer double faulted in the second set to give Kohlschreiber the break but won it on his second match point.
Also advancing in Tuesday's second-round action were Bulgarian Grigor Dimitrov and Julien Benneteau of France.
Tuesday's first-round winners included ninth-seeded Stan Wawrinka of Switzerland and No. 11 Tommy Haas of Germany.
Wisconsin business offering 'therapeutic cuddling' forced to close
Couple calls 9-1-1 over missing hash browns; assault McDonanld's employees