MELBOURNE, Australia -- Arguably the greatest Australian Open champion in the 105 years of the event, Novak Djokovic was stunned Thursday on Rod Laver Arena.

The world No. 2 fell to wild-card Denis Istomin 7-6 (8), 5-7, 2-6, 7-6 (5), 6-4 in the second round of the year's first major.

Djokovic, looking to become the first seven-time winner Down Under, was out of sorts from the outset. Fifteen minutes after the first ball was struck, he found himself still fighting for the opening game. It finally ended when Djokovic struck two unreturnable serves, ending the 24-point game.

It was downhill from there. Djokovic failed to rattle his opponent, the 117th-ranked player from Uzbekistan.

"All the credit to Denis for playing amazing," Djokovic said afterward. "He deserved to win. No doubt, he was a better player in the clutch moments."

The final match time: 4 hours, 48 minutes. Afterward, Istomin was deliriously contrite.

"First of all, I feel sorry for Novak. I was playing so good today," Istomin said in his on-court interview. "I mean, I surprise myself also today."

Istomin, who defeated a top-10 player for only the second time in his career (David Ferrer, 2012) and needed to win the Asia/Pacific wild-card playoff in Zhuhai, China, merely to reach the main draw, almost sounded subdued after Thursday's shocking win.

"So much emotion on my mind," he said haltingly. "I cannot hold it."

Denis Istomin of Uzbekistan came to Melbourne unseeded and as the 117th-ranked player in the world. Photo by Clive Brunskill/Getty Images

The first set alone lasted 1 hour, 25 minutes, including a 13-minute teetering tiebreaker that Istomin won when Djokovic's errant forehand sailed well past the baseline. Miscues were commonplace for Djokovic (72 unforced errors in all), as were missteps.

At 2-1 in the second set, Djokovic raced across the court at full speed and landed awkwardly. Immediately, he grabbed his left leg and bent over in pain. Djokovic called for the trainer then took a few minutes to stretch on the changeover chair.

The shocking nature of this match wasn't completely unexpected. Djokovic learned firsthand how rapidly the trajectory of a professional career can change, when his summer swing went south. After completing the career Slam at the French Open in June, Djokovic, who had a commanding lead in the rankings, began to labor.

It started with a startling loss to Sam Querrey in the third round of Wimbledon and was followed by a first-round setback against Juan Martin del Potro at the Rio Olympics. Although Djokovic reached the final of both the US Open and the ATP World Tour Finals, he fell in both, the latter costing him the year-end No. 1 ranking.

Still, he regrouped and began 2017 with a title at the Qatar Open, beating Andy Murray in a straight-sets final. In his opener in Melbourne, Djokovic handled Fernando Verdasco -- a 2009 Australian Open semifinalist -- in straight sets. Afterward, Djokovic spoke of his renewed frame of mind after an offseason of soul-searching. But on Thursday, the Serb was out of sorts, largely a result of his opponent's brilliant play.

"He stepped it up, played aggressive," Djokovic said. "Served very well, very precise. There's not much I could do. Of course, I was not pleased with my performance overall. But, you know, I have to congratulate my opponent today."

This was Djokovic's first loss to a player ranked outside the top 100 at a Grand Slam. He had been 33-0 against such opponents prior to Thursday.

"Take my bags and I go home," Djokovic said philosophically. "Lessons are always learned every single day, not just when you lose."

The last time a No. 2 seed fell in the second round or earlier at Melbourne Park was 2002, when Gustavo Kuerten, joined by No. 1 Lleyton Hewitt, fell in the first round. The last time it happened in a major was nearly five years ago when Rafael Nadal fell to No. 100-ranked Lukas Rosol in the second round.

Djokovic, a record six-time winner at the Australian Open and ranked second in the world, was out of sorts from the outset of his second-round match. Paul Crock/Getty Images

Early in the second set, with the players on serve, Djokovic cracked a surefire winner only to see Istomin, 30, run it down, stretch to full capacity and hook a clean winner around the net post. After a lethargic third set, Istomin came out in the fourth and matched Djokovic shot for shot. He ended the frame with an emphatic 119 mph ace in the tiebreaker.

"He started playing better from that point on," Djokovic said. "He just started swinging through and getting more confidence."

In the deciding set, it was hard to tell who the 12-time Grand Slam champion was. Istomin, who last season dropped out of the top 100 for the first time since 2010, broke Djokovic at 2-2 with a perfectly executed backhand winner. That was all he needed. Istomin finished the match with 17 aces and 63 winners.

Asked to put his performance in perspective, Istomin summed it up perfectly.

"It is the biggest [career] win," he said. "To me, it means so much. Now I feel that I can play with these guys and be on the same level."

Istomin will play No. 30 Pablo Carreno Busta in the third round.

In other results, Nadal, the 2009 champion, swept aside 2006 finalist Marcos Baghdatis 6-3, 6-1, 6-3 to advance to the third round. The 14-time major champion won on his third match point in 2 hours, 13 minutes.

Nadal, who lost in the first round here last year to Fernando Verdasco, is looking to win his first major since the 2014 French Open. He had two lengthy stints on the sidelines last year and played only four matches after a fourth-round exit at the US Open.

He will play Alexander Zverev in the third round. The 24th-seeded Zverev beat Frances Tiafoe in straight sets earlier Thursday.

Tthird-seeded Milos Raonic extended his streak of reaching the third round at all seven Australian Opens he has entered with a 6-3, 6-4, 7-6 (4) victory over Gilles Muller, the 33-year-old Luxembourg player who won his first title at tour level last week in Sydney.

Raonic, who reached the semifinals in Melbourne last year and the final at Wimbledon, said he was feeling the effects of a cold and sore throat but still fired 21 aces, hit 56 winners and had only 15 unforced errors. He next faces No. 25 Gilles Simon.

Also advancing were Brisbane International winner Grigor Dimitrov, No. 18 Richard Gasquet, US Open semifinalist Gael Monfils, No. 11 David Goffin, No. 8 Dominic Thiem, Benoit Paire and Ferrer, who beat U.S. qualifier Ernesto Escobedo 2-6, 6-4, 6-4, 6-2 to set up a third-round match against No. 13-seeded Roberto Bautista Agut.

Ivo Karlovic followed up his tournament-record 84-game first-round win with a straight-sets victory over wild card Andrew Whittington.

ESPN's Greg Garber and The Associated Press contributed to this report.