Nadal, who returned to the top of the world rankings this month, won his 67th match of 71 this season with a 6-1 7-6(5) victory over Carlos Berlocq.
Nadal hit 19 winners and only made four errors in a sublime first set, and while the second was more even Berlocq double-faulted at 5-5 in the tie-break, gifting Nadal a quarter-final spot.
Nadal will face Stanislas Wawrinka after the Swiss beat Milos Raonic in straight sets.
World number two Djokovic comfortably defeated Fabio Fognini 6-3 6-3 to advance to the last eight.
Dominating on his own serve from the off, Djokovic earned a break point on the Italian's service in game four and took it at the first time of asking before seeing out the opening set.
And though he had to save a break point at the very start of set two, the Serb broke Fognini again in the sixth game of the second before once again defending his serve well to secure a symmetrical straight-sets success.
"I needed to play a lot of long rallies and work for my points because Fognini is a player in form over the past three or four months," Djokovic told the ATP website.
"He's somebody that has a lot of talent, moves around the court quite fast [and] makes you work. It was a good win. In the important moments I served well. I played the right shots at the right time. A straight sets win is something that I was looking forward to."
Up next in the last eight for Djokovic is Gael Monfils, who upset Roger Federer earlier in the day.
"Monfils, from I watched, was the better player on the court and he deserved to win," added Djokovic. "He's always tricky when he serves big, as big as he served today.
"I think, he's one of the most interesting tennis players to watch because he's so athletic, he's so fast, he moves around the court well. He's somebody that feeds off the energy of the crowd. He loves to play big matches on a big stage."
The big shock of the day came as third seed and 2011 runner-up David Ferrer was beaten 6-4 6-3 by Germany's Florian Mayer.
Ferrer, who has already qualified for the ATP World Tour Finals in London, gave up a steady stream of break points against the world number 50 as Mayer took advantage of his superior serving to beat a top 10 opponent for the first time this year.
Juan Martin del Potro was gifted a spot in the quarter-finals as German veteran Tommy Haas was forced to retire injured.
The 35-year-old had beaten Daniel Brands and Sam Querrey to make the last 16, but his long-standing back problem flared up before the clash with the sixth-seeded Argentine.
Del Potro will face Nicolas Almagro in the quarter finals after the Spaniard landed a mini-upset on Czech world number six Tomas Berdych.
Jo Wilfried Tsonga also made the quarter-finals with a win over Japan's Kei Nishikori.
Tsonga was pushed hard by his 23-year-old opponent in a nip-and-tuck opening set that was decided in a tie-break, but hit his stride in the second set as he dropped not a single point on his own serve while tearing Nishikori to bits on his way to a 7-6(4) 6-0 victory.
Shanghai Masters Men's Singles Round 3 matches on Thursday
1-Novak Djokovic (Serbia) beat Fabio Fognini (Italy) 6-3 6-3
2-Rafael Nadal (Spain) beat Carlos Berlocq (Argentina) 6-1 7-6(5)
Florian Mayer (Germany) beat 3-David Ferrer (Spain) 6-4 6-3
15-Nicolas Almagro (Spain) beat 4-Tomas Berdych (Czech Republic) 6-7(6) 6-3 7-6(4)
Gael Monfils (France) beat 5-Roger Federer (Switzerland) 6-4 6-7(5) 6-3
6-Juan Martin Del Potro (Argentina) beat 11-Tommy Haas (Germany)WO
7-Jo-Wilfried Tsonga (France) beat 12-Kei Nishikori (Japan) 7-6(5) 6-0
8-Stanislas Wawrinka (Switzerland) beat 10-Milos Raonic (Canada) 7-6(2) 6-4
- Sports & Recreation
- Fabio Fognini
- Gael Monfils
- Carlos Berlocq
- Stanislas Wawrinka