"It's a great coup for us," said Gloucester head coach Dean Ryan.
"Understandably given his quality, experience and availability, there were a number of clubs keen to sign him and I am delighted we have got there first."
Ryan, whose side currently top the Guinness Premiership standings but were knocked out of the Heineken Cup at the group stages, believes Spencer can help the Cherry and Whites end their long wait for silverware later this season.
"Carlos will give us something a little bit different - a mystique and an ability to function at the highest possible level," added Ryan.
"He has huge international experience with the All Blacks and we believe he will be a great asset should we progress into the knockout stages of competitions later in the season. I am delighted that such an outstanding professional has agreed to join us."
Spencer won his first international cap in 1995 and made 34 All Black appearances up until 2004, scoring 291 points in the process, before leaving New Zealand to join Northampton from Auckland Blues four years ago.
The Kiwi playmaker stayed with the Saints when they were relegated from England's top flight back in 2007 but is now determined to challenge for honours at the top end of the table.
"I left Northampton with a ton of great memories - the club were fantastic and the supporters always treated me in a way I will never forget," said Spencer.
"Everything has happened pretty quickly over the last few days but the opportunity to stay in the Guinness Premiership and join a club as talented and ambitious as Gloucester is a rare one so I am thrilled.
"Gloucester have been at the forefront of the game in England for a number of years but the excitement of the challenge is driven by trying to help them take that last extra step and become winners.
"That is what excites me - I am joining a club that is genuinely challenging for the top honours around and I want to give it everything I can to help make them even more successful.
"They are a great team, with strong competition for places and I hope that I can play my way in and contribute fully to the end of the season push for honours."