In a match carried over from Friday after winning the first two sets, the hard-serving Querrey lost the third Saturday before ousting Djokovic 7-6 (6), 6-1, 3-6, 7-6 (5) in a third-round match at the All England Club.
"Congratulation to Sam. He played a terrific match," said Djokovic, who had won the past four major titles and was bidding to become the first man since Rod Laver to win them all in the same year since 1969. "He serves very well, as he usually does. I think that part of his game was brutal today. He made a lot of free points with the first serve. Just well done. He just overpowered me."
Also falling by the wayside was Djokovic's 30-match win streak in Grand Slam events, which ranks third all time and was just one behind Laver and six behind Don Budge's record of 37.
"I believe in positive things in life," Djokovic said. "I managed to win four Grand Slams in a row two different seasons. I want to try to focus on that rather than on failure."
Things began looking bleak for Djokovic when the match began Friday and he dropped the first two sets against Querrey, an American ranked 41st. After play was halted by rain, a recurring theme in this contest and the tournament as a whole, Djokovic came back out Saturday and played much better.
"He's on his way to possibly being the best ever," Querrey said, "and so you know he's mentally tough and he was going to come back."
He took the third set, then went up a break in the fourth at 5-4. Querrey steeled himself there to break right back, then held to lead 6-5.
That's when Saturday's third rain delay arrived, following those at 4-0 for Djokovic in the third set, and at 1-all in the fourth. When they resumed, Djokovic held serve to stay in the match and send the fourth set to a tiebreaker. Djokovic went ahead 3-1, but Querrey hung in there, and on his second match point, a stray forehand by the big favorite sailed wide to end it.
"I had my chances maybe in the fourth set, serving for the set," Djokovic said. "In the tiebreak, I was leading. Just wasn't feeling the ball as well as I wished. But that's sport."
It's the first loss for Djokovic at any major tournament in more than a year: He was beaten by Stan Wawrinka in the French Open final in June 2015. Since then, Djokovic won his third trophy at Wimbledon last July, his second at the US Open in September, his sixth at the Australian Open in January, and his first at the French Open less than a month ago.
"As I said, you know, in sports everything is possible," Djokovic said. "If you're playing somebody of as a high quality as Sam Querrey is on this surface with a big serve, anything can happen. I was a few points away from losing last year against Kevin Anderson in a very similar match on the same court. Sometimes it works in your favor, sometimes against. You got to deal with that."
Querrey, who became the first American to beat Djokovic at a Grand Slam event since Andy Roddick (2009), finished the match with 31 aces as he improved to 21-1 in his career when winning the first two sets.
"I'm really excited. It's an unbelievable win," Querrey said in a postmatch interview before heading off to play doubles. "To do it here at Wimbledon is really special. ... Iserved well the whole time, played a great tiebreaker at the end to get the win."
He has never made it past the fourth round at any major, but Querrey became the first American man to beat the No. 1 seed at a Grand Slam event since Andre Agassi ousted Lleyton Hewitt in the semifinals of the 2002 US Open.
Querrey will be joined in the fourth round by countryman Steve Johnson. The American beat Grigor Dimitrov 6-7 (6), 7-6 (3), 6-4, 6-2 to reach the round of 16 --where he will play Roger Federer-- for thefirst time in 17 Grand Slam appearances.
Andy Murray made his way into the fourth round by beating John Millman of Australia 6-3, 7-5, 6-2.
In other action, fifth-seeded Kei Nishikori also reached the fourth round -- equaling his best performance at the All England Club -- with a quick 7-5, 6-3, 7-5 win over Andrey Kuznetsov of Russia.
Nishokori, who made only 14 unforced errors, will next face Marin Cilic, who beat the Japanese star in the 2014 U.S. Open final.
Since then, Nishikori has won both of his matches with the Croat, both last year on outdoor hard courts. Their fourth-round match will be their first on grass.
Other seeded players to advance includeNo. 11 David Goffinand No. 14 Roberto Bautista Agut, who dispatched No. 19 Bernard Tomic in straight sets.
Meanwhile, the second round was finally completed -- two days later than normal because of weather issues -- as Alexander Zverevbeat Mikhail Youzhny6-4, 3-6, 6-0, 4-6, 6-2.
The weather has been a real problem at Wimbledon this week, and organizers have decided to play on the middle Sunday for only the fourth time in the tournament's 139-year history.
The Associated Press contributed to this report.
Querrey shocks Djokovic at Wimbledon
American Sam Querrey upsets Novak Djokovic in four sets at Wimbledon, snapping the top seed's streak of Grand Slam wins at four.