Everything was set up for Andy Roddick and the Americans to win.
A Davis Cup quarterfinal against Spain set deep in the heart of Texas, a hard surface that was supposed to complement their big hitters and a rowdy crowd of 16,000 ready to cheer them on.
Spain was even missing superstar Rafael Nadal, who skipped the matches to rest after losing the Wimbledon final.
None of it mattered to the feisty, passionate and inspired Spaniards, who tore through the singles matches undefeated to build an insurmountable 3-1 lead, denying Roddick a chance to win it in front of his hometown fans.
Spain's David Ferrer, the No. 6 player in the world, beat No. 8 Mardy Fish 7-5, 7-6 (3), 5-7, 7-6 (5) in a grueling 4-hour, 11-minute reverse singles match Sunday that clinched Spain's victory.
The win — its first on U.S. soil — sends the Spain to the semifinals, where it will host France on Sept. 16-18. Spain is seeking its third Davis Cup championship in four years.
"For us, this is a historic match," Spain captain Albert Costa said.
History certainly wasn't with the Americans.
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. The U.S. is now just 1-37 in Davis Cup when facing an 0-2 deficit. The only time they rallied was back in 1934 against Australia in London.
"Spain is probably the deepest team out there right now in men's tennis," said Jim Courier, who suffered 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.
Fish, who fell to 6-7 in Davis Cup play, played a grueling four-hour, five-set match on Friday and followed it with the longest match in U.S. Davis Cup play since the tie-breaker was introduced in 1989. The U.S. had won Saturday's doubles and a Fish victory would have put the deciding match on Roddick's big serve and broad shoulders.
Roddick is 12-0 in Davis Cup-clinching matches, but once Spain clinched the victory, Roddick's late match against Lopez was canceled.
"I badly wanted to get to the point we could get Andy out there. It just didn't happen," Fish said.
"Andy was ready for the ball. He wanted the ball," Courier said.
Fish led Ferrer 5-3 in the first set before Ferrer broke his 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 tie-breaker to win it. 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 drew a warning when he smacked a ball deep in the stands. The players traded three service breaks before Ferrer went up 5-4 when a shot by Fish slipped a fraction of an inch wide of the line.
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 a mob of teammates and team staff. Teammate Fernando Verdasco stood up and pumped his fist toward the small but loud group of Spanish fans who had supported their team with chants of "Ole!" and "Espana!" for three days. The team then danced on the court while Ferrer went to sign autographs and Nadal sent a message of congratulations.
"The guys, they are giving everything. It is a pleasure to be their captain," Costa said. "For us, this is a historic match."
After the win, the Spanish players were asked if they planned to celebrate their victory in the United States and the city that calls itself the "Live Music Capitol of the World."
"Oh my God," Lopez said, drawing huge laughs from his teammates.
"I think it's better not to talk about that," Verdasco said with a wide grin.
The Americans had planned for the party to be theirs, but simply couldn't deliver.
In other Davis Cup play Sunday, Serbia's Janko Tipsarevic beat Michael Ryderstedt of host Sweden 6-2, 7-5, 6-3 to give the defending champs an insurmountable 3-1 lead and a semifinal berth against Argentina.
In Germany, France completed a 4-1 victory over the Germans by splitting Sunday's reverse singles. Philipp Petzschner earned Germany's only point by beating Michael Llodra 6-3, 6-4 before Jo-Wilfried Tsonga beat Philipp Kohlschreiber 7-6 (3), 7-6 (5) in the final match.