The 26-year-old will join the club two years after pulling out of a spell with them because of a back injury.
Anderson, who has played 13 Tests, 44 ODIs and 29 T20 games, said "I'm excited to finally get the opportunity to play for such a distinguished club."
In 2014 he set a new record for the fastest ODI century, reaching his ton from 36 balls against West Indies.
However, that record was surpassed just over a year later when South Africa's AB de Villiers brought up three figures from only 31 balls against the same opposition.
Anderson will be available for the entire T20 Blast campaign, starting with Somerset's opening game against Surrey at The Oval on 9 July.
Director of cricket Matt Maynard said: "He's an exciting player and a very talented cricketer who strikes the ball exceptionally well.
"It was a shame that he couldn't play for us a few years ago but I have no doubt that he will show the supporters that it was worth the wait."
New Zealand all-rounder Corey Anderson has signed to play for Somerset in this season's T20 Blast.