The three-time Vuelta winner, riding in his last race before retirement, launched his attack early with 26.5km remaining in the 129.4km stage 15. Miguel Angel Lopez (Astana) joined him before going on alone for his second stage win of the race.
“I wanted to be brave and see what would happen behind me, but Sky has a very powerful group and it was complicated,” Contador said.
“I knew it was a risk, but I preferred to take it. It was a long effort and I struggled to finish it, but I do not regret what I did. It is my way of racing.”
Watch: Vuelta a España stage 15 highlights
Froome caught Contador with 3.4km to race. When Ilnur Zakarin (Katusha-Alpecin) attacked just before the final kilometre, Contador had little left and slipped behind by 40 seconds.
Froome continues to lead the race by 1-01 over Vincenzo Nibali (Bahrain-Merida). Contador slipped from eighth to ninth, at 3-59, behind Michael Woods (Cannondale-Drapac).
“It was difficult to keep up with the pace because we were going very fast ahead and in the middle part, it would have been quite comfortable in the main group behind,” he added. “That made me pay for it in the end, but you have to race the way you want and I enjoy doing it that way.”
Contador, 34, announced that the Vuelta a España would be his last race after he had a disappointing Tour de France in July. Every day, Spanish fans turn at the starts and finishes to wish him farewell and to encourage such attacks.
“I want to enjoy myself, just like I’ve been enjoying myself up to now,” he continued. “Let’s take it day by day.”