Spain competed in its first Davis Cup in 1921 but didn't reach the final round until 1965, when the team led by
Jaime Bartroli lost to Australia. They reached the final again two years later but though they had great players such as Manuel Santana and Manuel Orantes, Spain lost against Roy Emerson and company again.
Spanish fans had to wait 33 years in 2000, to see their team play another Davis Cup final, but this time the Spanish team defeated the Australians in Barcelona with Juan Carlos Ferrero as national hero. But Lleyton Hewitt, who had been defeated by Ferrero three years before, had his revenge very soon, when Spain lost to Australia again in 2003.
The following year, Spain reached the final once again. It was played in Seville and for the first time ever, they didn't have to play against Australia. Their opponents were the United States, and thanks to great performances from Carlos Moyá and an 18-year-old Rafael Nadal, Spain won their second Davis Cup.
Spain reached the final once again in 2008, and they won against Argentina. It was the first time that the Spanish team won the final on foreign soil. Unexpectedly, the Spanish heroes were Fernando Verdasco and Feliciano López, winning one single each and the doubles partnering together. David Ferrer, then World Number 5, lost in straight sets to David Nalbandian in the only match he played in the final; and Nadal, World Number 1, was injured, and he wasn't able to play in Argentina.
After winning the Davis Cup for the third time, Emilio Sánchez stepped down as captain to allow compatriot Albert Costa take his place. In 2009, second-seeded Spain cruised to their seventh Davis Cup final after home victories against Serbia, Germany and Israel, even though Costa struggled to make a team as Rafael Nadal and Fernando Verdasco missed two ties each. Spain played the Czech Republic, which previously eliminated first-seeded Argentina. The final was held in home ground again, where they hadn't lost a tie since 1999. Spain swept the Czechs 5–0 at Palau Sant Jordi in Barcelona, behind great performances from David Ferrer and Rafael Nadal to claim their second consecutive title, and the fourth in ten years.
Spain defeated Argentina in the 2011 final, held for the second time in Seville, by a score of 3–1 to claim their fifth title, and the third in four years.