Spain was a country located in Western Europe, on Earth. One of its settlements was Barcelona. It was the focal point of the Spanish culture, including the Spanish language. Spain's flag was three horizontal bands of red, yellow, and red. (ENT: "First Flight")
During the late 15th century, the Spanish set out to expel all non-Christians from Spain in what was known as the Spanish Inquisition. Q noted that, during this time, Earth had "character". (Star Trek IV: The Voyage Home; DS9: "Q-Less")
In the 19th century, Mexico, Spain's last territorial concession in North America, was able to gain its independence as the result of using violence as a political instrument. (TNG: "The High Ground")
Around the same time, British forces under the command of Arthur Wellesley fought in Spain against the French under Napoléon Bonaparte. (DS9: "The Visitor", "The Muse", "For the Cause")
In 2032, Spain took part in the Ares IV mission. (VOY: "One Small Step")
The Spanish flag could be seen on the Ares IV model, among others.
In 2143, the Ariane 1 assignment patch, which was on display in the 602 Club, bore the flag of ESA member Spain. (ENT: "First Flight")
According to the Star Trek Fact Files, Spain was a member of the International Space Agency in the early 21st century.
A scene in the script but not the aired version of "Family" mentioned a Spanish museum, the Prado.