Ferrer's three-set win handed Spain an insurmountable 3-1 lead in the best-of-five tie.
But following singles win Friday by Ferrer and Nicolas Almagro, the Sunday reverse singles win was enough to hand Spain its 23rd consecutive Davis Cup home court victory.
The Spanish squad will host the United States in the September semis.
The Americans advanced Sunday with an upset of France.
Couple mistakenly served bag of cash at McDonald's drive-thru
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'