I didn't use my T-Mobile; instead I rented a cell phone from National Geographic's Cellular Abroad:
http://www.cellularabroad.com/
I used it to call home (California) and to make calls within Spain. Incoming calls were free. Battery charger included. It's probably not the cheapest way, but it...