The 34-year-old left Manchester United this summer after a frustrating 18-month spell in which he made just two appearances and spent the second half of last season on loan at Standard Liege.
"You can't imagine how delighted I am because it's not usual to bring players like him to recently promoted teams," head coach Aitor Karanka told mfc.co.uk.
"I'm really pleased because he is really committed
All the conversations we've had he knows why he is here and he is coming to add to what we have.
"He knows how strong this group is
It's a privilege for us to be able to bring a player like this to the club."
Valdes, who made over 500 appearances for Barcelona in a 13-year career in which he won the Champions League three times, LaLiga six times and also picked up winners' medals for Spain at the 2010 World Cup and Euro 2012, is Middlesbrough's fifth signing of the summer after Viktor Fischer, Bernardo Espinosa, Marten de Roon and Jordan McGhee.
Source : PA