The move will see him reunited with Tottenham boss Mauricio Pochettino, who managed the 24-year-old Kenya captain during his spell as Saints manager.
Wanyama arrived at St Mary’s from Celtic for £12.5m in 2013 and scored four goals in 85 Premier League games.
He asked to leave last summer after interest from Spurs but stayed, helping Southampton to a sixth-place finish.
In a letter addressed to Southampton fans published on his website, Wanyama wrote: “It is very emotional for me to say goodbye to the club that gave me the chance to be the first Kenyan to play in Premier League.”
He added: “I will never forget my time in Southampton Football Club, I will keep club forever in my heart.”
The signing is Spurs’ first since they finished third in the Premier League to secure a place in the 2016-17 Champions League group stages.
He moved to Scotland from Belgian club Germinal Beerschot for an undisclosed fee in July 2011, having initially joined Helsingborgs of Sweden in 2007.