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.
Benedict Cumberbatch's dramatic reading of R. Kelly lyrics is just what you need
Beyonce flaunts bikini body, Blue Ivy in vacation pics