Juan Martin del Potro had doubted he could win the six matches in eight days needed for another Olympic medal.

After all, this is a player who went 2½ years between majors because of three left wrist surgeries before he entered Wimbledon this year. But now that the 2009 U.S. Open champion is into the quarterfinals in Rio de Janeiro, he can start dreaming a bit about those medal rounds.

Del Potro came from behind Thursday to beat 117th-ranked Taro Daniel of Japan 6-7 (4), 6-1, 6-2, looking strong in the final set of a match that lasted 2 hours, 12 minutes.

The Argentine stunned top-ranked Novak Djokovic in the first round, part of nearly 7 hours on court between singles and doubles in a span of about 25 hours Sunday and Monday. He had a scheduled day off Tuesday, then the match with Daniel was postponed Wednesday by rain, providing some extra rest.

"This has been a great tournament, a great week for me already," del Potro said. "I'm looking forward to go far, trying to fight for one medal. I'm still playing well, but the next round is going to be a really difficult match for me."

His opponent will be 10th-seeded Roberto Bautista Agut of Spain, whose movement on the baseline could be a challenge. But as del Potro and his forehand showed against Djokovic, he's one of the best in the world when he's healthy and fit — even now with his surgically repaired wrist causing problems for his two-handed backhand.

Daniel actually has a better ranking than del Potro, who is 141st in the world after his injury layoffs. But whereas the 23-year-old Daniel had never defeated a top-30 player before his first-round victory over 25th-ranked Jack Sock, del Potro has beaten Roger Federer in a major final and Djokovic for bronze at the 2012 London Games, among other big wins in his career.

Still, del Potro said of Thursday's match: "I had doubts in the beginning, and I got myself into a mess."

He had 22 unforced errors in the first set and 15 combined in the last two.

"I started the second set angry," he said.

When del Potro went up two breaks in the third set with a winner on a volley that was more self-defense than anything, he pumped both fists and screamed toward the stands, which were dotted with Argentine flags.

"In the end," he said, "the crowd helped me a lot to survive."