Djokovic seemed in full control when he went 3-1 up in the second set but allowed the Spaniard to fight back to 4-4 before going on to seal the match.
Bautista Agut could have gone 5-4 up in the second set after Djokovic appeared to send the ball long, but the umpire said it was in. Television replays showed the ball was out.
Instead it was Djokovic who broke to take a 5-4 lead and won the match when he had a forehand ruled in.
Nadal, the fourth seed, broke Sock's serve twice in the second set and served out the match to set up a last-eight meeting with Dominic Thiem, who was beaten by Nadal in the Madrid Open final last week.
"I am here to try my best. I know (it) is a tough tournament. I don't have an easy draw here, a tough one," Nadal said. "Dominic is the player that is having probably more success now on clay, no? So will be another tough battle tomorrow."
The 30-year-old Nadal has won consecutive clay-court tournaments in Monte Carlo, Barcelona and Madrid. The Spaniard is aiming for an eighth title at the Foro Italico as he prepares for the French Open in less than two weeks.
"I think I can play a little bit more aggressive than what I did tonight. I think I have to do it," Nadal said. "But in general terms I am happy with the way that I played, obviously."
Thiem also beat an American but had to save two match points in a 3-6, 6-3, 7-6 (7) victory over Sam Querrey.
"It's a situation for me where I'm going out there against the No. 3 player in the world. Maybe I have a little bit less to lose than he does," Isner said. "I went out there with the belief that, if I played well and executed my game plan, that I could walk off that court with a win. That's what happened today."
Isner grabbed the only break of the match at 3-3 in the second set before comfortably serving out the match on his first attempt after Wawrinka had saved two match points on his serve.
Home favorite Fabio Fognini, who saw off top-seeded Andy Murray on Tuesday, lost 6-3, 6-3 to Alexander Zverev, who will play fifth-seeded Milos Raonic in the quarterfinals after the Canadian beat Tomas Berdych 6-3, 6-2.
Konta had won her previous three meetings against Williams but the American dominated the first set. Although Konta rallied in the second, another double break in the third handed Williams victory.
"I love this tournament, and I love Rome," Williams said. "It's one of my favorite places on earth, so that's one of the reasons why I have always come here.
"You know, I have had a good amount of success here."
Estonian qualifier Anett Kontaveit, who beat top-ranked Angelique Kerber in the second round, continued her dream debut. Kontaveit beat 16th-seeded Mirjana Lucic-Baroni 6-1, 6-1 to set up a quarterfinal against Madrid Open champion Simona Halep.
"I'm just really trying to take it match by match and setting these really small goals," the 21-year-old Kontaveit said.
Sixth-seeded Halep beat Anastasia Pavlyuchenkova 6-1, 4-6, 6-0.