Mayoral, 23, joins the club on an initial two-year loan deal, for a fixed fee of €2 million.
As part of the agreement, Roma has the option to make the transfer permanent at any point during the 2020-21 season for a fee of €15m.
In the second season, the cost to exercise this option rises to €20m.
Should either option be exercised, the player has already agreed a contract with the club which will run until 30 June 2025.
“I am pleased to finally join – it has been a hectic few days, but the main thing is everything has worked out for the best,” Mayoral said.
“It’s an honour for me to represent an historic club like Roma. I am grateful to the club for the faith they have shown; I will give everything for this club and I hope to make our fans proud.”
Mayoral, a Spain Under-21 international, has also represented his country at Under-17 and Under-19 level.
Official announcement: Borja Mayoral#RealMadrid— Real Madrid C.F. 🇬🇧🇺🇸 (@realmadriden) October 2, 2020
He has made 33 appearances for Real in his career, scoring seven goals.
A product of the Real Madrid youth academy, he has previously enjoyed loan spells at VfL Wolfsburg and Levante, prior to joining the Giallorossi.
“With this signing we are adding a talented player to the group, and one who has learned his trade at a renowned club like Real Madrid,” said Guido Fienga, the club’s CEO.