Andrey Rublev, of Russia, returns the ball to Alejandro Davidovich Fokina, of Spain during the Mutua Madrid Open tennis tournament in Madrid, Sunday, April 28, 2024. AP
The Kazakh, who has a tour-leading three titles this season after triumphing in Stuttgart last week, broke twice in the first set to move 5-0 ahead on the Spanish clay.
Although Sherif battled harder in the second set, surviving four match points to hold for 5-4 down, Rybakina clinched the victory on serve at the Caja Magica.
"Despite the score, it was a very tough match," said Rybakina, who has the best record on the tour this season with 28 wins.
"It was a lot of deuces and we both fought a lot -- I'm really happy with the performance today."
Rybakina will face teenager Sara Bejlek in the next round after the Czech defeated American Ashlyn Krueger 6-3, 6-1.
"I've never played against a player like this," said the 18-year-old. "I will try my best and we'll see how it will go tomorrow."
In the men's draw Andrey Rublev came back from 5-0 down in a first set tie-break to beat home favourite Alejandro Davidovich Fokina 7-6 (12/10), 6-4 in a nervy affair.
The world number eight kept his nerve and saved five set points to stun his opponent, before a similarly hard-fought second set.
Rublev broke for a 5-4 lead with a shot which the Spaniard chose to leave as he thought it was long, but Hawk-Eye showed it was in by a whisker.
The Russian wrapped up his win with a forehand winner, his second win of the week after four straight defeats.
Last year's Madrid runner-up Jan-Lennard Struff defeated France's Ugo Humbert 7-5, 6-4.
The German could face last year's victor Carlos Alcaraz in the last 16 if the Spaniard defeats Thiago Seyboth Wild later Sunday.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)
Short link: