Rodrygo's previous deal would have expired in 2025, having joined from Santos as an 18-year-old in 2019.
The Brazil international already has a hatful of trophies since moving to the Spanish capital and has 39 goals in 179 appearances.
An official statement from the 14-time European champions, announcing Rodrygo's new deal read: "Real Madrid C.F. and Rodrygo have agreed to extend the player's contract, which remains linked to the club until June 30, 2028.
"Rodrygo arrived at Real Madrid in 2019, when he was only 18 years old. He debuted with Real Madrid Castilla on September 14 and on September 25 he scored his first goal in his official debut with Real Madrid.
"In his five seasons defending the first team shirt he has played 179 games, in which he has scored 39 goals and won eight titles: one Champions League, one Club World Cup, one European Super Cup, two Leagues, one Copa del Rey and two Spanish Super Cups.
"At 22 years old, Rodrygo has been decisive in many titles that Real Madrid has won in recent seasons. On the way to the 14th European Cup, Rodrygo scored several goals that allowed Real Madrid to overcome those qualifying rounds that are now part of our history. In the team's last title, the 2023 Copa del Rey in Seville, he scored the two winning goals (2-1) and was the MVP of the final."
Earlier this week, Rodrygo's compatriot, Vinicius Junior, signed a new contract with Real Madrid until summer 2027.