SHANGHAI (AP) — Khris Middleton's two free throws with 2.1 seconds remaining in overtime saved the United States from what would have been a shocking loss, and the two-time defending champion Americans somehow rallied to beat Turkey 93-92 in a World Cup Group E game on Tuesday night.

Turkey went 0 for 4 from the foul line within a span of nine-tenths of a second, the last two misses coming from Cedi Osman with 8.2 seconds left. Middleton went to the rim on the ensuing possession, got fouled and made both shots.

Turkey had a chance at the end, but Ersan Ilyasova's jumper was off the mark and the Americans escaped.

"It was a heck of a game," U.S. coach Gregg Popovich said. "As we all know, it was anybody's game. We will accept the win."

The Americans have now won 21 consecutive World Cup games, extending the record for any nation at FIBA's signature event. The U.S. also extended its winning streak to 55 games in international tournaments with NBA players on the roster, starting with the bronze-medal game at the 2006 world championships.

But it had to sweat this one out, all the way to the end.

Middleton led the Americans with 15 points and Kemba Walker — who single-handedly erased a five-point U.S. deficit in overtime with a 3-pointer and another score sandwiched by his drawing an offensive foul — scored 14 in a game where Jayson Tatum had to make two of three free throws with one-tenth of a second left in regulation to save them. Tatum sprained his left ankle at the end of overtime, putting his status for at least the immediate future in doubt.

Ilyasova led Turkey with 23 points. Melih Mahmutoglu had 18, Furkan Korkmaz scored 16 and Osman added 15 for Turkey.

The win clinched a second-round berth for the U.S., but only after Osman and Dogus Balbay went 0 for 4 from the line with Turkey up by one in the final seconds of overtime.

"It really hurts," Korkmaz said. "I think it was in our hands — not their hands."

Ilyasova's tip-in with 12.3 seconds remaining in regulation gave Turkey its first lead at 81-79. Turkey had gone 0 for 9 on shots to take the lead before Ilyasova's swat bounced off the rim and dropped through the net.

The U.S. went for the win on the ensuing possession, first with Middleton missing a 3-pointer and then the ball finding Tatum as the last seconds ticked away. He got fouled by Osman as he took a 3-point attempt from the top of the key; the scoreboard showed no time left, but officials put one-tenth of a second on after review.

He made the first. The second rimmed out. The third, with the game on the line, rattled home.

Turkey had a chance on the final play of regulation, but a lob to the rim got knocked away easily, sending the game to OT.

The U.S. ran out to a quick 10-2 lead and never trailed in the half, though it was far too close for the Americans' comfort. It was 26-21 after the first quarter, though it seemed like the Americans had control again when they led 41-26 with 5:33 left in the half.

That's when Turkey got a spark — by a guard born in Gainesville, Florida.

Scottie Wilbekin, who played four years of college ball for Florida and got his Turkish passport last year, fueled a 12-0 run that awoke the pro-Turkey crowd of 18,000 at the Shanghai Oriental Sports Center. He got it going with a 3-pointer, fed Ilyasova for another 3 not long afterward and converted a four-point play with 3:12 left in the half.

And it stayed tight the rest of the way — until they could finally exhale.

"It means a lot. It means a lot, man," Walker said.

Team USA faces Japan on Thursday in Shanghai.