The top-seeded Nadal saved all four break points he faced against No. 23 Lopez and hasn't been broken once this year at Flushing Meadows.
Early in the third set, Nadal did his best Roger Federer impression, chasing down a lob and, with his back to the net, hitting the ball between his legs. But unlike Federer, who pulled off the trick shot for winners at the U.S. Open both last year and this year, Nadal lost the point -- because Lopez was standing at the net and calmly volleyed the ball away.
Still, Nadal finished with an impressive ratio of 34 winners to 14 unforced errors.
Nadal and Lopez began playing after 11 p.m. Tuesday night and finished at 1:16 a.m. Wednesday, the final match on Arthur Ashe Stadium on a schedule that included a five-set men's match, a three-set women's match and a lengthy two-set women's match.
"Yeah, of course, it's difficult. You have to be awake," Lopez said. "It's a long day for Rafa and for me. But we knew it's going to be like this."
Nadal won the French Open and Wimbledon this year to raise his total to eight major championships. He needs a U.S. Open title to complete a career Grand Slam.
Now Nadal will play No. 8 Fernando Verdasco in the first all-Spanish quarterfinal in U.S. Open history. It's a rematch of their classic 2009 Australian Open semifinal, a five-setter that Nadal won in 5 hours, 14 minutes. That's part of Nadal's overall 10-0 record against Verdasco.
"Everybody knows that he's No. 1 in the world; he's great player," Verdasco said. "My record is not good against him. But I will keep trying and keep fighting."
Earlier, Stanislas Wawrinka beat Sam Querrey in five sets to put two Swiss men in a Grand Slam quarterfinal for the first time in the Open era -- and keep the Americans out of that round in the U.S. Open for the second straight year.
Wawrinka won 7-6 (9), 6-7 (5), 7-5, 4-6, 6-4 to join a countryman whose presence this deep in a major tournament is just assumed: Federer. Not so for Wawrinka. The 25-year-old had been 0-5 in the round of 16 at Grand Slams.
"Roger, he's always in quarterfinals since many years, so that's not something different," Wawrinka said. "But for me, it's my first time, so it's something important for my career."
The U.S. men, meanwhile, had at least one quarterfinalist at their home major each of the first 41 years of the Open era. That changed in 2009, and now it's happened again. This year goes down as the worst for American men in Grand Slam events. They had only one quarterfinalist at the four major tournaments: Andy Roddick at the Australian Open.
"Yeah, you think about it," Querrey said when asked by a reporter about the U.S. drought. "I mean, you guys tell me that every day I'm in here. I didn't feel any extra pressure or anything. I definitely wanted to win and keep the American men, keep the hope going. You know, I was close."
Close to the first Grand Slam quarterfinal berth of his career. He had his chances Tuesday. So did the 25th-seeded Wawrinka, as momentum swung back and forth as quickly as the wind whipped around Arthur Ashe Stadium, the two players trading mistakes and big shots.
"Just a couple points here and there," Querrey said. "It was like every set was like that, just really, just a couple of points in every set that made the difference."
No. 20 Querrey wasted three break points in the third game of the final set, which seemed headed to another tiebreak until Wawrinka made one final push leading 5-4.
Querrey fought off one match point with a lob that was just high enough to force deuce. But after Querrey hit a forehand into the net, Wawrinka made the most of his second chance.
"I was pretty sad in the locker room for a little while," Querrey said. "I don't feel that great right now. You know, pretty tired. My body is tired. But, I mean, it was an unbelievable match."
The youngest man left in the draw, the 22-year-old Querrey was in the midst of a breakthrough season, reaching the fourth round at a second straight Grand Slam. He entered the top 20 in the rankings for the first time in July and had won four titles this year; only Nadal has more.
With Wawrinka upsetting fourth-seeded Andy Murray in the third round, the draw seemed to be opening up for Querrey to make a deep run. His quarter of the bracket didn't have anybody left seeded in the top 10.
In contrast, Wawrinka didn't come into the Open looking like a future quarterfinalist. A former top 10 player, his ranking had slipped to No. 27, the lowest in more than two years.
But Wawrinka had the experience of a 13-7 record in five-set matches. Querrey was just 1-2.
Wawrinka will next face Mikhail Youzhny, who briefly slowed Spain's march through the U.S. Open bracket.
The 12th-seeded Russian beat Tommy Robredo, the lowest-ranked man left in the draw, 7-5, 6-2, 4-6, 6-4. The 41st-ranked Robredo was one of a record six Spanish men to reach the fourth round at Flushing Meadows.
Verdasco rallied from two sets down for a 5-7, 6-7 (8), 6-3, 6-3, 7-6 (4) victory over David Ferrer.
The eighth-seeded Verdasco trailed 4-2 in the fifth set and 4-1 in the fifth-set tiebreak Tuesday before winning a match that took 4 hours, 23 minutes.
To close out one of the best matches of the tournament, Verdasco hit one of the best shots of the tournament -- sliding to get to Ferrer's drop shot at the net and then whipping a forehand barely around the outside of the net post for the final winner.
"It's tough to explain," Verdasco said when asked about his closing shot. "You are just, you are with your sixth sense, in the ball, in the point, knowing how important it is, and, just trying to run, fight."
This was only the second time Verdasco has overcome a two-set deficit to win.
Information from The Associated Press was used in this report.