AUSTIN, Texas (AP)—David Ferrer beat Mardy Fish 7-5, 7-6 (3), 5-7, 7-6 (5) to clinch a 3-1 victory for Spain over the United States in the Davis Cup quarterfinals.

Ferrer, who beat Andy Roddick on Friday night, fell backward when Fish’s final shot sailed wide, then jumped into the arms of Spain captain Albert Costa. The win gave Spain, seeking a third Davis Cup title in four years, an insurmountable 3-1 lead and a spot in the semifinals against France.

Playing without world No. 2 Rafael Nadal, resting after losing the Wimbledon final, Spain went 3-0 in singles. Spain had to overcome a rowdy pro-American crowd to earn its first Davis Cup victory in the U.S. After Ferrer’s victory, Sunday night’s scheduled match between Roddick and Feliciano Lopez was canceled.

Lopez beat Fish on Friday. The Americans won their only point Saturday in doubles.

Ferrer, ranked No. 6 in the world, trailed Fish 5-3 in the first set, then broke serve twice in winning the next four games. Frustrated by 20 unforced errors in the set, Fish slammed and broke a racket.

Fish dialed up a dominant serve in the second, but Ferrer still pushed the set to a tiebreaker and won it 7-3. Fish rallied to win the third set before Ferrer put the match away in the fourth.

With the crowd getting louder to support Fish after every winning shot, Ferrer looked frustrated and even drew a warning when he smacked a ball deep in the stands. The players traded three service breaks before Ferrer went up 5-4.

Fish still forced a tiebreaker and trailed 0-3 before rallying with three straight points. The match ended on a long rally before Fish’s final shot sailed wide.

“It was a very long match, a very tough match,” Ferrer said. “It’s a very special moment for me.”

After hugging Costa, Ferrer was surrounded by teammates and team staff. Fernando Verdasco stood up and pumped his fist toward the small but loud contingent of Spanish fans who had supported their team with chants of “Ole!” and “Espana!” for three days. The Spanish team then danced on the court while Ferrer went to sign autographs.

It wasn’t the result the Americans had expected after deciding on the venue deep in the heart of Texas, a hard surface that was supposed to complement their big hitters.

“For us, this is a historic match,” Spain captain Costa said. “The guys, they are giving everything. It is a pleasure to be their captain.”

Spain had already turned Nadal’s absence into an afterthought when Feliciano Lopez beat Fish in the first singles match Friday and Ferrer whipped Roddick in straight sets in front of a stunned home crowd.

“Spain is probably the deepest team out there right now in men’s tennis,” Jim Courier said following his first defeat as U.S. captain. “Playing Spain home or away is going to be tough, with or without Rafa.”

The U.S. hasn’t won the Davis Cup since 2007, and Roddick had lobbied to have this quarterfinal played in his home town. Austin responded with a rowdy reception for the Spaniards, waving American flags and peppering the matches with chants of “U-S-A!”

Roddick’s wife, model and actress Brooklyn Decker, wore red and blue and waved a red-white-and-blue pom-pom. One sign held up after a Ferrer miss on Sunday read “Rafa would have made that!”

But none of the rousing cheers could push the Americans to a singles victory.