The Spanish Armada attacked England in 1588 in an attempt to establish Spain's dominance in Europe and prevent Protestantism from overtaking Catholicism on the continent. Other reasons included Span's desire to prevent England establishing a strong navy and Mary Queen of Scots' execution.
In the years preceding the Spanish Armada's 1588 invasion, Europe was torn between Catholicism and Protestantism. This was due to the Protestant Reformation earlier in the century, which saw several countries split with Rome. As a Catholic leader, Phillip II wished to see England return to Catholicism. In addition, while his country had a stronghold in the Spanish Netherlands, Dutch rebels were helping Protestantism flourish there and Queen Elizabeth I of England was aware that full Spanish control would make her country vulnerable. As such, she intervened there in 1585, providing support to the Dutch rebels.
While the struggle between Protestant and Catholic Europe were key motivators for the invasion, there were other catalysts. Mary Queen of Scots was a threat to Protestant rule in England, and when Queen Elizabeth II executed her in 1587, Catholic Europe was shocked. Phillip II was once married to Elizabeth's sister, Mary. Before dying Mary, stated that Mary Queen of Scots was the next rightful heir, with Phillip following. This led Phillip to believe that he was England's next true king following her execution. Finally, the Spanish were successfully exploring the world, and felt uneasy as England began to establish a navy that could rival theirs.