MEXICO CITY — Novak Djokovic rallied to beat Argentinian Juan Martin Del Potro in three sets 4-6, 6-4, 6-4 early on Thursday to advance to the Mexican Open quarterfinals.

Djokovic, playing in his first tournament since his shocking loss in the second round of the Australian Open, struggled to beat Del Potro, the 2009 U.S. Open winner, who ousted the Serbian 7-6 (4), 7-6 (2) in the first round of the Olympic Games in Rio de Janeiro.

It was the first match between them since.

"Every time you play against Delpo, there's a lot of tension, emotions and quality of play," Djokovic said. "I'm happy I was able to beat him this time."

The 29-year-old Serbian, ranked No. 2, suffered an unexpected loss to Uzbekistan's Denis Istomin on the Australian Open.

Djokovic, making his debut in Acapulco, was losing 4-3 in the third set, but he broke Del Potro twice and was able to preserve his serve to get the victory.

The Serbian star will play against Australian Nick Kyrgios, who qualified with a 6-2, 6-4 victory over American Donald Young.

Spaniard Rafael Nadal routed Italian Paolo Lorenzi 6-1, 6-1 earlier to move on to the next round. Nadal won the tournament in 2005 and 2013 and has a 12-match winning streak in the event.

"Unfortunately, I will lose eventually," Nadal said. "But the harmony with the crowd and the court is amazing. With all of the support from the people, it gets easier."

The 30-year old Spanish star will face Japan's Yoshihito Nishioka, a 6-4, 3-6, 6-0 winner over Australia's Jordan Thompson.

Nadal is playing in his first tournament since losing to Roger Federer in the Australian Open final.

"I played a complete match today and I*m feeling great after a month without playing," Nadal said.

Another player on a winning streak in Acapulco is defending champ Dominic Thiem, who downed Adrian Mannarino, of France, 7-5, 6-3 to reach the quarterfinals.

It was the Austrian*s seventh consecutive win of the season and also his seventh in Mexico.

Thiem, who won his eighth career title last week in Rio de Janeiro, will play American Sam Querrey, who beat fifth-seed David Goffin 6-2, 6-3 of Belgium.

Querrey served seven aces and finished off Goffin in just over an hour. Goffin, 11th in the ATP rankings, was coming off a strong performance in Rotterdam, where he lost the final to Jo-Wilfred Tsonga.

Croatia's Marin Cilic also beat countryman Borna Couric 6-3, 2-6, 6-3 to reach the quarterfinals for the second tournament in a row. He will play American Steve Johnson, a 7-6 (5), 6-3 winner over countryman Ernesto Escobedo.

On the women's side, Puerto Rico's Monica Puig, the fourth seed, beat Slovakia's Daniela Hantuchova 6-4, 6-4. Also, the Ukraine's Lesia Turenko led Julia Goerges 6-1, 2-0 when the German retired. Croatian Ajla Tomljanovic also retired from her match against Belgian Kirsten Flipkens, who was winning 7-5 after the first set.

In a match between Americans, Christina McHale beat Taylor Townsend 6-1, 7-6 (5), and third-seeded Jelena Ostapenko of Latvia advanced with a 7-5, 6-4 victory over American Madison Brengle.

France's Pauline Parmentier beat eighth-seeded Andrea Petkovic of Germany 6-4, 3-6, 6-1, and Kristina Mladenovic, from France, defeated Heather Watson, from Britain 7-6(4), 6-7(5), 7-5 in a match that lasted 3 hours, 32 minutes — four minutes shy of the longest WTA match of the year.