The 1700s began on the same note as succession issues led to an internal war. This war ended with the crowning of the first Bourbon king, who further destroyed local rights and made a stronger national government. This began a slow modernization period that lasted into the 1800s.
In the early 1800s Napoleon took over Spain with the help of the Spanish ruler; this led to the birth of the Spanish War of Independence. The people, who sought to overthrow Napoleon and his Spanish leadership were supported by the Portuguese and British, eventually leading to independence, but also losing nearly all of Spain's colonies.
Just before the 1900s, the Spanish-American War broke out, but it was very short-lived as Spain lost their remaining colonies to either independence or the United States, including the Philippines, Cuba, and Puerto Rico.
The 1900s began with a Spanish push to colonize Africa, but most political efforts were focused domestically as a number of changes were implemented and new freedoms were offered. Not all of these changes were welcomed though and in the 1930s the Spanish Civil War broke out and moved right into World War II (WWII), with the new government remaining neutral, but sympathetic to the Axis powers of Italy and Germany.
After WWII, Spain was courted by both sides of the Cold War and in the 1950s joined the United Nations and allied with much of Western Europe; in the 1980s this continued as they joined NATO and the European Community. In the 1970s Spain's king died and the country became a democracy, immediately giving greater rights to the smaller regions of Spain. Today, Spain remains an integral member of the European Union (EU), which was founded out of the European Community.