NEW YORK (AP) -- David Ferrer needed a mid-match pedicure of sorts. He seemed bothered when his opponent got a mid-game medical timeout. He was down a break in the fifth set.
In the end, though, the indefatigable Spaniard was barely better, as he usually is when matches go the distance.
With his high-energy brand of leg-churning, ball-chasing tennis, the fourth-seeded Ferrer outlasted eighth-seeded Janko Tipsarevic of Serbia 6-3, 6-7 (5), 2-6, 6-3, 7-6 (4) in 4 hours, 31 minutes Thursday to reach the U.S. Open semifinals for the second time.
Ferrer trailed 4-1 in the last set, but in the next game, Tipsarevic slammed to the ground while chasing a drop shot and stayed down for a few moments. Tipsarevic later had his right thigh taped up.
Ferrer, also a semifinalist at Flushing Meadows in 2007, has won four consecutive five-setters and is 17-9 overall.
When the match ended on Tipsarevic's backhand into the net, Ferrer raised his arms, then knelt near the baseline. The weary foes met at the net for a hug.
"I don't have words,'' said Ferrer, who reached the semifinals at the French Open in June. "It was a very emotional match.''
Might have been the best of these two weeks so far, filled with twists and turns and plenty of theater.
Ferrer next will play defending champion Novak Djokovic or 2009 champion Juan Martin del Potro for a spot in Sunday's final. Djokovic and del Potro were scheduled to play the last men's quarterfinal Thursday night.
Olympic champion Andy Murray and 2010 Wimbledon runner-up Tomas Berdych - who eliminated 17-time major champion Roger Federer in four sets - earned their semifinal berths Wednesday.
Ferrer is the only man left who has never reached a Grand Slam final.
He had various issues Thursday, including a dispute over a line call early in the fifth, and a bothersome toe on his right foot that a trainer worked on in the third - removing Ferrer's sneaker and sock and using a pair of nail clippers to help fix things. At another changeover, Ferrer gestured wildly while exhorting himself between bites of a banana.
The 28-year-old Tipsarevic was playing in only his second quarterfinal in 35 career Grand Slam tournaments. He reached that round in New York a year ago, too, but stopped playing because of a left leg injury while trailing his Davis Cup teammate and good pal Djokovic.
On Thursday, he hit one shot by thrusting his racket around his back and closed another point by doing the splits while flipping up a lob.
"It was a really, really tough match,'' Ferrer said. "Janko - he's an amazing player ... and he also deserves to win today.''
Until now, Tipsarevic might have been best known not for his skills with a racket but rather for the large tattoos in Japanese lettering on his arms. The one on the left borrows a line from Fyodor Dostoyevsky's "The Idiot'': "Beauty will save the world.''
The tennis highlight for Tipsarevic to this point probably was joining Djokovic to help Serbia win the 2010 Davis Cup title.
After ending that season ranked 49th, Tipsarevic jumped into the top 10 in 2011. He entered Thursday's match only 4-22 against men ranked in the ATP's top five, but one of those previous victories came against Ferrer.
Not this time.
Ferrer broke Tipsarevic to go ahead 5-3 in the fourth, then served it out at love. At the changeover before the final set, it was Tipsarevic's turn for treatment on both of his feet.
Tipsarevic saved break points in the fifth set's opening game, then went ahead 2-0 by breaking Ferrer with a volley winner and eventually made it 4-1. On the last point of the sixth game, though, Tipsarevic's left foot gave out from under him as he tried to chase Ferrer's drop shot. Tipsarevic landed on his left hip with a frightening thud; up in the stands, his wife covered her mouth with her hands.
Ferrer walked up to the net to check on Tipsarevic, who gave him a thumb's up then limped to the sideline and gathered himself.
In the very next game, Ferrer broke to close to 4-3. One hold of serve later, it was even.
Facing two break points at 4-4, 15-40 in the fifth set - if Ferrer converted one of those chances, he would have served for the victory - Tipsarevic asked for a medical timeout after grabbing his upper right leg in the middle of a point.
So smack-dab in the midst of that very crucial game, a trainer came out to assess Tipsarevic's injury, then taped up the thigh. Play resumed, and Ferrer lost four points in a row. Tipsarevic sprinted forward to hit a volley winner, erasing the first break point, then took care of the second with a service winner and wound up holding to lead 5-4.
When Ferrer's volley winner made it 5-all soon thereafter, he yelled "Vamos!'' in Tipsarevic's direction.
Two games later, as the concluding tiebreaker was about to begin, fans in Arthur Ashe Stadium rose to salute both players with a standing ovation. Ten minutes later, Ferrer was the one celebrating.