The 30-year-old put pen to paper in a ceremony at Valdebebas alongside club president Florentino Pérez, with honorary president Pirri also in attendance.
Dumfries received a replica of the stadium, a watch and a shirt bearing his name before posing for photographs as a Real Madrid player for the first time.
"I'm very proud to play here, I'm very grateful and I'm looking forward to starting the season," Dumfries said.
"For everyone it's a dream to play for Real Madrid. Being here is a big responsibility, of course, because we have important goals. I'm very proud and very happy to be here.
"I'm ready to start."
The signing fills a clear need at right-back following the departure of Dani Carvajal, giving head coach Jose Mourinho two contrasting options in the position. Real Madrid activated Dumfries' release clause, reported at around €20m, to prise him away from Inter Milan after five strong seasons in Italy, during which he made 207 appearances, scored 27 goals and provided 28 assists, winning two Serie A titles and reaching two Champions League finals along the way.
"It's a very important match. The first match is always very important and of course we're going to go there to win," Dumfries said, looking ahead to Real Madrid's LaLiga opener. "I'm happy to be able to make my league debut. Looking forward to the match arriving and starting this new journey with everyone. Let's go for it tomorrow."
His European pedigree is considerable. In last season's Champions League semi-final against Barcelona, Dumfries produced a memorable individual display, scoring twice and setting up three further goals. Now 30 and at the peak of his powers, he arrives at the Santiago Bernabéu hoping his power and attacking threat can prove decisive.
The challenge will not be straightforward. Dumfries will compete for the right-back role with Trent Alexander-Arnold, one of the club's marquee signings for the position, though Mourinho has already experimented with fielding both players together, opening the door to a Madrid side with greater depth and variation down the right flank. Dumfries will wear the number 24 shirt.
