I'm a US resident and am looking to rent a car in Spain.
How do I get a license to drive there?
I always recommend getting an international driving permit even if it isn't enforced. An IDL costs $25 US, takes 15 minutes, and can be picked up at any AAA (If you are from the USA). They are handy if you get pulled over or as a second form of (unofficial) ID should something happen. Keep in mind it is only valid if you have you original license with you, so keep that handy.
I'm guessing that you already have a US driving license? If not, you can potentially get a Spanish one, but it'll take a while and I'm not sure you'll manage to hire a car to learn in... See this page for details on getting one.
If you have a US license, then this UK site has some handy tips on driving in Spain, rules etc. In terms of an International Driving Permit, this site says that US drivers do technically need one in Spain, but it's not always enforced, though I've seen other places that say it varies depending on the state that issues your license! Probably safest to just get one before you leave, see travel.state.gov for details on how you get one as an American.