NEW YORK — Novak Djokovic fended off a fading Andy Murray 7-6 (1), 6-7 (1), 6-2, 6-4 in a matchup of past U.S. Open champions to reach the tournament’s semifinals for the eighth consecutive year.

It took a while for the No. 1-ranked and No. 1-seeded Djokovic to push himself out front in a well-played, back-and-forth, 3-hour, 32-minute match that ended after 1 a.m. Thursday.

Djokovic broke the eighth-seeded Murray to go up 3-1 in the third set, then fended off a pair of break points in the next game. On the first, Murray sailed a backhand long to end a 28-stroke point, then leaned over and put a hand on his knee. On the second, he dumped a forehand into the net, then slammed his racket against his right thigh and yelled.

Soon, Murray was turning to his box to say, “Nothing in the legs.” In the fourth set, a trainer came out to deliver a heat pack to Murray.

He had back surgery a year ago, and in his first-round match in New York last week, he barely managed to overcome cramps all over his body. Murray had looked fine since then, but he couldn’t sustain his top form throughout the physically demanding quarterfinal against Djokovic, who won the U.S. Open in 2011 and has played in the past four finals.

On Saturday, Djokovic will take on 10th-seeded Kei Nishikori, the first man from Japan to reach the U.S. Open semifinals since Ichiya Kumagae in 1918. Nishikori outlasted third-seeded Stan Wawrinka of Switzerland 3-6, 7-5, 7-6 (7), 6-7 (5), 6-4 earlier Wednesday.

That match lasted more than four hours, and Nishikori managed to shake off any lingering exhaustion from his previous victory, which took 4:19 and ended at 2:26 a.m. Tuesday, equaling the latest finish in tournament history.

In the women’s quarterfinals, top-seeded Serena Williams dropped the first three games before quickly turning things around to defeat 11th-seeded Flavia Pennetta of Italy 6-3, 6-2. Williams, who counts five U.S. Open titles among her 17 Grand Slam trophies, will play 17th-seeded Ekaterina Makarova of Russia in the semifinals.

Williams has a 19-match winning streak at Flushing Meadows, including the 2012 and 2013 championships.

“Against her, you can’t wait, you can’t give her time, you can’t fail to push her to her limits — because if you do, she’s a runaway train,” Pennetta said.

For two sets, Djokovic-Murray was reminiscent — in terms of pure entertainment value and setting, if not quite star power — of the 2001 classic between Pete Sampras and Andre Agassi, which also was a quarterfinal, and also under the lights at Arthur Ashe Stadium. That one, won by Sampras, featured four tiebreakers, because neither man broke serve even once.

If the sublime-serving Sampras against the terrific-returning Agassi provided a contrast in styles, Djokovic vs. Murray was more a case of mirror images. Two of today’s top returners, they combined for 11 service breaks, seven by Djokovic, including in the final game. They are also both brilliant baseliners and retrievers, and it helps that they know each other — and each other’s patterns — so well.

Born a week apart in May 1987, they were contesting their 21st tour-level matchup and sixth at a Grand Slam tournament. Both of Murray’s major titles — at the U.S. Open in 2012, and at Wimbledon last year — came via victories over Djokovic. Two of Djokovic’s seven major trophies — at the Australian Open in 2011 and 2013 — came against Murray.

The first set Wednesday was a thing of beauty, a 73-minute exercise in shape-shifting and shot making. Both tracked down would-be winners and somehow got them back.

Points lasted 10 or 20 strokes or more, extended by Djokovic’s slides and splits or Murray’s gifted anticipation. And there were crowd-riling displays of emotion.

When Murray sailed a backhand wide at the end of a 30-stroke point, Djokovic raised his right fist, bellowed, “Come on!” and windmilled his arms in an attempt to get the spectators on his side.

On the next point, Murray produced a backhand winner, and the often-staid Scot motioned to the fans, too.

When that set came down to a tiebreaker, Murray lost his way at a most inopportune time: He entered the night 0-8 against Djokovic when dropping the first set. Murray double-faulted, put a return into the net, flubbed a backhand and, before he knew it, that set belonged to Djokovic.

Djokovic went up a break in the second set at 2-1. Murray broke back, though. Djokovic took another of Murray’s service games to go up 4-3. And, yes, Murray again broke back, delivering an inside-out forehand winner that left an angered Djokovic swatting a spare ball off the serve-speed digital readout.

Murray would dominate that set’s tiebreaker, but soon enough, he was the one who was frustrated.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.