Spain is dotted with international airports, and connections with the rest of Europe are good. If you're coming from the UK or from Morocco, you could consider a ferry. Otherwise, bus is the cheapest option, unless you're a whipper-snapper with an under-26 rail pass.
Getting around within Spain is best done by bus; the bus network gives you better coverage and more mile for your dollar than the rail system. If you're swanning off to the Balearics, you can go the whole luxury hog and get a flight, or pleb it on a ferry.