The 27-year-old midfielder, who has been capped 88 times for her country, had been expected to make the move to the Spanish capital this summer following the expiry of her contract at Manchester City.
Born and raised in Dunfermline, Weir had spoken earlier this year of her dream to play for Real Madrid and that will become a reality after four years at the Etihad Stadium.
Weir could make her competitive Real Madrid appearance in a Champions League qualifier against Austria's Sturm Graz on August 18, with the winner – ironically – facing her old club City or Tomiris-Turan of Kazakhstan for a place in the second round.
Real Madrid finished third in Spain's First Division last season, behind champions Barcelona and Real Sociedad.
They also competed in the Champions League for the first time since the team was formed in 2020. They made it to the quarter-finals before losing out to Barcelona.