Kubo, who moves from Tokyo for a reported €2 million ($3.3 million) fee, made his J.League debut at the age of 15.
The now 18-year-old, who is considered one of Asia's most exciting young talents, made his full Japan debut this month and is in its squad for the Copa America.
Kubo will play for Madrid's reserve team Castilla next term and becomes its latest signing ahead of the 2019-2020 season.
After an underwhelming campaign, Zinedine Zidane's squad has been boosted by the arrivals of Eden Hazard, Ferland Mendy, Luka Jovic, Eder Militao and Rodrygo Goes.
Kubo was previously on the books of Barcelona and was linked with a return to Madrid's LaLiga rival, with Ligue 1 champion Paris Saint-Germain also said to be interested.
But Madrid has signed the teenager, who was described in a club statement as "one of the most promising young players in world football".