LONDON — Limping between points and fading down the stretch, defending champion Andy Murray was stunned by 24th-seeded Sam Querrey of the U.S. 3-6, 6-4, 6-7 (4), 6-1, 6-1 in the Wimbledon quarterfinals Wednesday.

Sam Querrey of the United States celebrates after beating Britain’s Andy Murray. Associated Press

The No. 1-seeded Murray came into the tournament dealing with a sore left hip and it clearly impeded him at Centre Court. He grimaced as he stumbled or landed awkwardly while attempting shots.

Sam Querrey took full advantage to reach the first Grand Slam semifinal of his career – and the first for any American man anywhere since Andy Roddick was the runner-up at Wimbledon in 2009.

“I am still in a little bit of shock myself,” Querrey said.

There was another quarterfinal surprise later Wednesday, when three-time Wimbledon champion Novak Djokovic stopped playing because of a right arm injury while trailing 2010 runner-up Tomas Berdych of the Czech Republic 7-6 (2), 2-0. After dropping the opening set, Djokovic took a medical timeout while a trainer massaged his arm. A day earlier, during his fourth-round match, Djokovic had his right shoulder worked on by a trainer.

Serbia’s Novak Djokovic, right, retired injured from his match with Czech Republic’s Tomas Berdych. Associated Press

Seven-time champion Roger Federer moved into his 12th semifinal at the All England Club with a straightforward 6-4, 6-2, 7-6 (4) victory over 2016 runner-up Milos Raonic. That left Federer as the only member of the sport’s so-called Big 4 still standing: In addition to the exits for Murray and Djokovic, Rafael Nadal lost in the fourth round. That quartet has combined to win each of the past 14 Wimbledon titles.

Switzerland’s Roger Federer hits a return to Canada’s Milos Raonic on Wednesday. Associated Press

In Friday’s semifinals, Querrey will face 2014 U.S. Open champion Marin Cilic of Croatia, who also won a five-setter Wednesday, getting past 16th-seeded Gilles Muller 3-6, 7-6 (6), 7-5, 5-7, 6-1 with the help of 33 aces. On the other half of the draw, Federer will face Berdych.

Murray is normally a terrific returner, but Querrey hit 27 aces. He was impeccable for portions of the match, finishing with 70 winners and only 30 unforced errors.

“He was dictating all of the points,” Murray said.

From 1-all in the fourth, Querrey grabbed eight games in a row to take that set and lead 3-0 in the last.

“I didn’t start my best, but I just kept with it. Kept swinging away and then really found a groove in the fourth and fifth set,” Querrey said. “And everything kind of seemed to be falling my way then.”

It is the second year in a row that the 29-year-old Californian upset the defending champion and top-seeded man at the All England Club. In 2016, he ended Djokovic’s 30-match Grand Slam winning streak by beating him in the third round.

Murray didn’t have that sort of recent dominance, but he is a three-time major champion and had been to at least the semifinals at the All England Club in seven of the past eight years.

The hip, though, was a problem this time. Murray had to skip some practice sessions and pull out of a couple of planned exhibition matches before Wimbledon. Even though he kept insisting once the tournament began that he was OK, he was not capable of his best.

Murray’s serve speeds slowed, and his backhands didn’t have their usual verve. He couldn’t play his usual court-covering defense.

“I was pretty close today. It wasn’t like I was, like, a million miles away from winning the match,” Murray said. “Obviously the end was a bit of a struggle.”

Querrey is the lowest-ranked player to ever beat two-time Wimbledon champion Murray in his 12 appearances at the grass-court Grand Slam tournament.

For Murray, this was the fourth five-set match he’s lost in a row. Querrey is headed in the opposite direction: Merely 4-10 in fifth sets for his career until last week, he has won each of his last three matches by going the distance: against 12th-seeded Jo-Wilfried Tsonga in the third round, Kevin Anderson in the fourth, and now Murray.

Querrey always has had an intimidating serve, but he’s never managed to put together his overall game for enough matches to play on the final weekend at a major.

Indeed, until last year’s win over Djokovic, he might have been best known for some of his unusual off-court episodes. In Thailand for a 2009 tournament, he cut two muscles in his right arm when he sat on a glass table that shattered. Two years ago, he appeared on the reality TV show “The Millionaire Matchmaker.” There’s a popular video clip on social media of Querrey – sunglasses and hat on, shirt unbuttoned – dancing with friends wearing horse-head masks.

Now Querrey’s on-court accomplishment Wednesday will make headlines. Win two more matches, and he’ll be the Wimbledon champion.