NEW YORK — Richard Gasquet is getting the hang of this five-set thing.
The eighth-seeded Gasquet reached his second Grand Slam semifinal, and first since 2007, by eliminating fourth-seeded David Ferrer of Spain, 6-3, 6-1, 4-6, 2-6, 6-3, at the US Open Wednesday.
‘‘It means a lot,” said the Frenchman. “I'm 27, so the last time I did it, I was 21 years old.
“For sure, it’s a big victory for me.’’
In the women’s draw, unseeded Flavia Pennetta came out a winner over 10th-seeded Roberta Vinci in the most important meeting between the Italians in a friendship and rivalry that has lasted more than 20 years.
Blunting Vinci’s net attacks, taking away her deft drop shots and preying on her nerves, Pennetta made it to her first Grand Slam semifinal with a 6-4, 6-1 win.
‘‘I know how she plays, she knows everything of me,’’ Pennetta said. ‘‘We get in the court, and I think today was more about inside, not about tennis. It was about how you play, how you feel in the court, and how can you handle the situation.’’
Gasquet was playing in only the second major quarterfinal of his career, having been 1-15 in fourth-round matches until edging No. 10 Milos Raonic Monday, also in five sets. Gasquet is 7-12 in matches that go the distance, a far cry from Ferrer’s 19-10 mark.
But it was Ferrer who faltered down the stretch after coming back to even the match by winning the third and fourth sets. Ferrer, the runner-up to Rafael Nadal at the French Open in July, played a loose game while down, 3-2, in the fifth, including a double fault on break point.
Gasquet’s only previous Grand Slam semifinal came at Wimbledon six years ago, when he lost to Roger Federer. He’s the first Frenchman to make the US Open semifinals since Cedric Pioline in 1999.
Ferrer entered Wednesday with an 8-1 head-to-head record against Gasquet. But Gasquet’s smooth, one-handed backhand was on target from start to finish during the nearly 3½-hour match, and he finished with 21 winners off that wing, while Ferrer had only nine.
Gasquet served out the opening set at love, capping it with a point in which he hit two cross-court backhands that pushed Ferrer wide of the doubles alley, then smacked one down the line for a winner.
In Saturday’s semifinals, Gasquet will face No. 2 Nadal, a 12-time major champion, or No. 19 Tommy Robredo, who entered Wednesday night with an 0-6 record in Grand Slam quarterfinals.
There could be little doubt about which player Gasquet would prefer to face. He is 0-10 against Nadal on tour, 2-2 against Robredo.
Against Nadal, Gasquet noted in an on-court interview, ‘‘I never won. Last time I beat him, I was 13. It was a long time ago.’’
Viewed as potentially one of the next greats of the game when he turned pro as a teenager in 2002, Gasquet has struggled to live up to those lofty expectations.
In 2009, after testing positive for cocaine, he missed the French Open and Wimbledon while serving a suspension that was reduced to 2½ months on appeal. An appeals panel accepted Gasquet’s explanation that the drug inadvertently entered his system when he kissed a woman in a Miami nightclub hours after withdrawing from that city’s tournament because of an injury.
Pennetta will play the winner of Wednesday’s quarterfinal between No. 2 Victoria Azarenka and 48th-ranked Daniela Hantuchova. No. 1 Serena Williams and No. 5 Li Na won Tuesday to secure spots in the other semifinal.
The women’s match marked the ninth meeting between Vinci and Pennetta, who, back in 2009, became the first Italian woman to crack the top 10. But she fell out of the spotlight in her country’s tennis scene after the emergence of Vinci and Sara Errani, combined with a wrist injury that sidelined her during the end of last season.
Pennetta came into Flushing Meadows ranked 83d but will leave with victories over both of Italy’s top players.
After her win over Vinci, the Italians met at the net and hugged. Vinci gave Pennetta a kiss on the cheek and told her, ‘‘Brava.’’
‘‘She’s someone who, when she wants something, she wants it all costs, which is the right way to be,’’ Vinci said. ‘‘It might seem strange to say it, but it’s great when a person gets back to this level after an operation. She deserves to be in the semifinals.’’
Unlike most women in this era of baseline tennis, Vinci attacked the net 34 times. But she won only 18 of those points. She finished with 14 winners and 28 unforced errors. Trailing, 5-4, in the first, Vinci saved a pair of set points and had two chances to break, but couldn’t convert either. Vinci attacked the net on the last two points of the set, but Pennetta hit shots Vinci couldn’t handle both times to close things out.
The second set took only 24 minutes.
Vinci said her style is, well, her style, and it has served her well through a career that brought her into the top 15 for the first time this summer.
‘‘Yes, of course I have a different kind of tennis,’’ she said. ‘‘This is my key. Sometimes it helps me, sometimes not. Depends, of course, the opponent.’’
This was Pennetta’s fourth straight win over a seeded opponent — a stretch that began with a 6-3, 6-1 win over fourth-seeded Errani and also included a victory over No. 27 Svetlana Kuznetsova, the 2004 US Open champion.
‘‘I play good tennis with Sara, with Kuznetsova,’’ Pennetta said. ‘‘Every day, much better and better.’’
Pennetta hasn’t lost a set en route to the final four of the year’s last major.