Shapovalov, who will face Nadal on Thursday, finished with seven aces and converted three of 11 break point opportunities in a match that lasted two hours 26 minutes.
Nadal had lost last week in the Madrid quarters while Shapovalov made the semifinals, and had beaten the Spaniard a year ago in Canada. And that's what I did today.
"It's true that I had 15-40 and a couple of break points in the first game, 15-40 and a couple of break points in the second return game and I didn't make them". I also had control, more or less, of a high percentage of the points.
Whereas Shapovalov made 14 more unforced errors (29) than winners (14), Nadal was plus-2 in that department (16 to 14) as he booked his spot alongside Fabio Fognini in the quarterfinals. "He probably stopped to serve that big a little bit, and I was a little bit more relaxed".
Nadal will next face Canada's Denis Shapovalov, who faced a grueling test in battling past Dutchman Robin Haase 7-6 (3), 6-7 (5), 6-3 in almost two and a half hours. "I feel like she's the No. 1 player in the world and she's great on clay".
Djokovic, back after a troublesome elbow injury, showed flashes of his formidable best as he beat Spain's Albert Ramos-Vinolas 6-1 7-5 and will meet Japan's Kei Nishikori in the next round.
Defending champion Alexander Zverev continued his excellent form with a 7-5 6-2 win over Matteo Berrettini, his 10th victory in a row.More news: Confirmed: Black Ops 4 gets Battle Royale mode
More news: Irish ladies lead the way on BAFTA TV Awards red carpet
More news: It's a boy! John Legend, Chrissy Teigen welcome second baby
Zverev will next play ninth-seeded David Goffin, who was leading 6-2, 4-5 when Juan Martin del Potro retired because of a groin injury. The Italian knocked out sixth seed Dominic Thiem earlier this week and will now feature in his fourth Masters 1000 quarter-final after defeating Peter Gojowczyk 6-4, 6-4 earlier in the day.
Halep needed to reach at least the last eight and go further than world number two Caroline Wozniacki to retain the top ranking going into the French Open.
Wozniacki faces 15th-seeded Anastasija Sevastova in a late match.
Previous year in Rome, Halep rolled her ankle in the final and lost a lead and the championship to Elina Svitolina.
The 21-year-old managed to beat Kyle Edmund of Great Britain, who knocked out 12-time Grand Slam champion Novak Djokovic of Serbia at the recent Madrid Open, by a 7-5, 7-6 scoreline.
Venus Williams, who won the Rome title back in 1999 and is bidding for her 50th career title this week, got her first win on clay this season.
The 24-year-old destroyed his racket in fury as he suffered his first loss to Fognini in three meetings, sinking 6-4 1-6 6-3.