NEW YORK — Pushed to a fifth set after coming so close to victory, defending champion Marin Cilic kept his act together and held on to get back to the U.S. Open semifinals.

Unfazed by wasting a big lead or match points, the ninth-seeded Cilic stretched his winning streak at Flushing Meadows to 12 matches by beating 19th-seeded Jo-Wilfried Tsonga of France 6-4, 6-4, 3-6, 6-7 (3), 6-4 on Tuesday night.

“A big mental fight,” the Croatian called it, “especially after losing that fourth set.”

The quarterfinal took nearly four hours in Arthur Ashe Stadium, delaying the start of the match between Serena and Venus Williams. A large crowd of spectators gathered outside the arena, waiting to enter for the night session.

Cilic appeared to be heading to a relatively straightforward win after taking the first two sets, considering he was 47-0 in his Grand Slam career when up by that margin.

But Tsonga took the third set by finally converting his seventh break point of the match, and then serving it out from 15-30 by taking the last three points with a pair of service winners at 131 mph and 132 mph, followed by a 124 mph ace.

Tsonga, the 2008 Australian-Open runner-up, then saved three match points in the fourth set to force a fifth.

“Jo just came up with amazing shots,” Cilic said.

In the last set, Cilic broke at love to lead 3-2, and didn’t falter this time, although he did need another two match points to close it out, double-faulting on one, before finally winning when Tsonga sailed a forehand long.

“It’s a lot of frustration, of course, but that’s tennis,” Tsonga said.

In the semifinals, Cilic will face No. 1 Novak Djokovic or No. 18 Feliciano Lopez of Spain, who were scheduled to meet in Tuesday’s last match. It was Djokovic’s 26th consecutive Grand Slam quarterfinal, including nine in a row at Flushing Meadows. For the 33-year-old Lopez, it was his first time making it that far in 14 U.S. Open appearances, and only his fourth career quarterfinal at any major tournament.

The two men’s quarterfinals on the other half of the men’s draw are Wednesday: No. 2 Roger Federer vs. No. 12 Richard Gasquet of France, and No. 5 Stan Wawrinka vs. No. 15 Kevin Anderson of South Africa.

Tsonga entered his quarterfinal against Cilic having held in all 56 of his service games in the tournament, a streak that reached 60 before Cilic broke to go up 5-4 in the first set. Cilic broke early in the second, too, and wound up winning three of Tsonga’s service games.

Tsonga helped out by double-faulting 11 times.

“I just served, I would say, very bad compared to the other days,” Tsonga said.

Cilic, meanwhile, hit 29 aces and saved nine of 10 break points.

Cilic wore a thick brace on his right ankle, which he tweaked during his fourth-round victory over another Frenchman, Jeremy Chardy. But it was Tsonga who appeared more troubled by an ailment, wearing a thick band of tape under his left knee.

“I don’t really want to talk about this, you know,” Tsonga said. “It’s part of the game, unfortunately, for me.”