WIMBLEDON, England — The great Roger Federer could see the upset coming. Even if the rest of us, and Novak Djokovic, perhaps did not.

Californian Sam Querrey defeated Djokovic, the No. 1-ranked player in the world, in four often-interrupted sets played over two days.

“I know we get carried away,” Federer said about Djokovic’s seeming invincibility, four straight Grand Slam tournament wins. “Think it’s impossible to beat him. Clearly he’s beatable. It’s not impossible.”

As Querrey verified in a match on Court One that started Friday and was stopped after two sets — both won by Querrey — by rain and darkness and then halted four more times when it returned yesterday. Querrey stunned Djokovic, and all tennis, winning 7-6 (6) 6-1, 3-6, 7-6 (5).

Djokovic had won 30 consecutive matches at the Slams, carrying him to the titles at the Australian Open, French Open, Wimbledon and U.S. Open over two seasons. Now, Djokovic will not win the calendar Grand Slam, last achieved by Rod Laver in 1969.

“He just overpowered me,” Djokovic said of Querrey, who served 31 aces. “I had my chances, maybe in the fourth set, serving for the set. In the tiebreak I was leading, just wasn’t feeling the ball as well as I wished. But that’s sport.”

advertisement | advertise on newsday

Djokovic, ranked No. 1, was riding the “Novak Slam,” four consecutive victories in the majors starting with Wimbledon last year. Querrey, 28, is 41st in the rankings, although seeded No. 28 here because of his big serve — who never quite went as far in the sport as many thought, possibly because of a bizarre accident seven years ago when a glass table on which he was sitting in Bangkok collapsed and a shard pierced his right arm.

Born in San Francisco and raised in southern California, the 6-6 Querrey went pro out of high school a decade ago instead of accepting a scholarship to USC on the advice of his father, Mike, who had turned down a chance to sign with Detroit Tigers, went to the University of Arizona and then couldn’t make a career out of baseball.

Sam Querrey has made a career out of tennis but not the one some thought. This is only his fourth time past the third round of a Slam event.

“Just stayed the course,” Querrey said, in what could as much be a description of his years of tennis as the match. “Didn’t do anything special. Can be tricky with all these rain delays. But I played the break points really well.”

The assumption was that having had his momentum run stopped by the weather Friday, Querrey would be a wreck by yesterday, knowing Djokovic could rally — and rally is what Djokovic did, winning the first five games played yesterday and taking the third set.

@NewsdaySports

“He’s on his way to possibly becoming the best ever,” Querrey said of Djokovic. “You know he’s mentally tough, and he was going to come back.”

While Querrey knew that was a distinct possibility, it didn’t seem to bother him.

“I slept great,” he said. “I’m a pretty relaxed guy.”

Djokovic seemed out of sorts. Someone asked if he was not feeling well. To his credit, he refused to discuss anything but the fine play of Querrey, who had won only one of nine previous matches between the two.

“If you’re playing somebody of as high quality as Sam Querrey on this [grass] surface, anything can happen,” said Djokovic. “I was a few points from losing last year in a similar match on the same court. He served very well as he always does, and that part of his game was brutal today.”

advertisement | advertise on newsday

In the Open era of tennis, starting in 1968, Djokovic is only the second top-seeded man to lose in the third round at Wimbledon. He chose not to dwell on the loss.

“I believe in positive things in life, and I managed to win four Grand Slams in a row — two different seasons, though. I want to try to focus on that,” Djokovic said, “rather than failure.”