MELBOURNE, Australia — It started badly for Novak Djokovic, who needed 24 serves, six break-point saves and 15 minutes just to hold his first game in the second round.

This was not the close-to-invincible Djokovic that fans were used to seeing at the Australian Open, where he has won a record-equaling six titles, including five in the previous six years.

In his earliest loss at a Grand Slam tournament since 2008, Djokovic lost 7-6 (8), 5-7, 2-6, 7-6 (5), 6-4 on Thursday to No. 117-ranked Denis Istomin, a 30-year-old wild-card entry from Uzbekistan.

"All the credit to Denis for playing amazing. He deserves to win," Djokovic said of their four-hour, 48-minute match. "He was the better player in the clutch moments.

"Obviously, I was not pleased with my performance overall, but I have to congratulate my opponent. Whenever he needed, he came up with a big serve, big play."

Djokovic hadn't dropped a set to Istomin in six previous matches. But he lost the 85-minute first set in a tiebreaker and then seemed to get the momentum back, only for Istomin to finish stronger.

Istomin's only previous win in 33 matches against top-10 players was in 2012 versus then-No. 5 David Ferrer.

"It is the biggest win for me. It means so much," Istomin said. "Now I feel I can play with these guys, and to be with them on the same level."

Serena Williams, who like Djokovic was ranked No. 2 and is a six-time Australian Open champion, kept her chase for an Open-era record 23rd major title on track with a 6-3, 6-4 win over Lucie Safarova.

After winning a rematch of the 2015 French Open final against Safarova, Williams will play fellow American Nicole Gibbs in the third round.

"It's never easy to play in the second round someone you've seen in the final of the biggest stage in tennis," Williams said. "I'm happy to have gotten through it."

Third-ranked Agnieszka Radwanska didn't last much longer than Djokovic, losing her second-round match to Mirjana Lucic-Baroni 6-3, 6-2. Radwanska reached the semifinals in Melbourne last year; Lucic-Baroni hadn't won an Australian Open match since 1998 until her first-round win this week.

No. 28 Alize Cornet and No. 31 Yulia Putintseva were the only other seeded women to lose on Day 4.

Among those advancing were U.S. Open finalist Karolina Pliskova, WTA Finals champion Dominika Cibulkova, 2016 Australian Open semifinalist Johanna Konta, No. 14 Elena Vesnina, No. 16 Barbora Strycova, former No. 1 Caroline Wozniacki and No. 22 Daria Gavrilova, representing Australia's last hope in the women's draw.

Djokovic was the only one of the men's seeded players to lose on a long day capped by ninth-seeded Rafael Nadal's 6-3, 6-1, 6-3 win over 2006 finalist Marcos Baghdatis.

Both players have had famously late nights at Melbourne Park — Nadal losing the latest-finishing final in Grand Slam history; Baghdatis losing to Lleyton Hewitt in third-round match in 2008 that finished at 4:34 a.m.

Returning from an extended injury layoff, 14-time major champion Nadal didn't let this one get out of hand — finishing at 12:08 a.m.

He'll play No. 24 Alexander Zverev next. Others advancing included No. 3 Milos Raonic, No. 6 Gael Monfils, No. 8 Dominic Thiem, No. 11 David Goffin, No. 13 Roberto Bautista Agut, No. 15 Grigor Dimitrov and No. 18 Richard Gasquet.

No. 20 Ivo Karlovic followed up his tournament record 84-game first-round win with a straight-set victory over wild-card entry Andrew Whittington, while No. 30 Pablo Carreno Busta went through to an unlikely third-round match against Istomin.

Djokovic held all four majors simultaneously after winning his first French Open last year. Now the French is the only one he can defend in 2017.

He had reached the fourth round or better in Australia every year since 2007, and held the No. 1 ranking for 122 consecutive weeks until he was overhauled by Andy Murray last November.

"I'm not used to losing Australian Open second round," Djokovic said. "I've done so well here."

That didn't matter to Istomin, nor seemingly to the Rod Laver Arena crowd.

The centre court wasn't at capacity as the match extended into the scheduled night session, and Djokovic's usually vocal Serbian fans were also not a big presence.

Much of the crowd, sensing an upset, was behind Istomin in the fifth set. When the Uzbek made a backhand winner for the decisive break in the fifth game of the last set, he let out a roar and the audience roared, too.

When Djokovic's last service return floated long, the crowd leapt up and cheered.

"First of all, I feel sorry for Novak," Istomin said, thanking his mother and coach, Klaudiya Istomina, in the crowd. "I was playing so good today. I surprised myself, as well."