My husband and I drove from Madrid to Barcelona 3 years ago and made it in about 8-9 hours with only one quick stop in a small town...We took the tollways, expect to pay about 40 bucks for the tollways, worth it for the roads, and to make good time, otherwise the trip is longer on the smaller highways...
Last year we decided to take the talgo to Barcelona and even though it took 8 hours, it was about 25 dollars, which actually saved money considering gas and rental prices...
So, If you wanted to save time by renting a car instead of the train, you won't...and may end up costing more...but, if you want to do your own roadtrip, spend time taking side trips, then renting a car is the way to go...Happy travels!!!