The Spanish giants clearly see the 23-year-old as their long-term replacement for Xabi Alonso in the defensive midfield role at the Bernabeu.
A Real statement read: "Real Madrid have signed Asier Illarramendi, who is now tied to the club for the next six seasons.
"The player will be presented tomorrow (Saturday) after undergoing the relevant medical tests."
Illarramendi was a key man at Sociedad last term, helping the San Sebastian club finish fourth and secure a Champions League berth, before playing every match as Spain U21s won the European Championship this summer.
"It hasn't been an easy decision," he said. "It has been very difficult for me to decide, because Real Sociedad have given me so much.
"I was on holiday when we started to hear about the interest from Real Madrid. There were contacts, we mulled it over, and we came to the conclusion that it was an offer we couldn't refuse. It's a unique opportunity.
"I thank the board, the academy coaches, the backroom staff and my team-mates (at Sociedad). I wish them all the best, this club will achieve great things."
Sociedad president Jokin Aperribay added: "This morning the LFP (Liga de Futbol Profesional) called to tell us that Real Madrid have activated Illarramendi's buyout clause.
"We have a very important year ahead of us with a young coach (Jagoba Arrasate) and we wanted all our players to stay.
"We told Real Madrid that we wouldn't negotiate, and we said the same thing to Asier and his agents. We fought very hard for him to stay and it's been a difficult few days.
"We wish him all the best and hope he doesn't forget his time at La Real."
Illarramendi is Madrid's fourth signing of the summer, following his fellow Spaniards Isco and Dani Carvajal, who joined from Malaga and Bayer Leverkusen respectively, while Brazilian midfielder Casemiro made his loan move permanent.