SHANGHAI -- In the ultimate moments, everything hinged on free throws.
Turkey missed them.
The U.S. made them.
And that is how the Americans escaped what would have been a massive World Cup upset. Khris Middleton's two foul shots with 2.1 seconds left in overtime capped a wild finish to a wild game, as the U.S. held off Turkey 93-92 in a Group E game on Tuesday night -- a contest that the underdogs simply gave away in the final moments.
"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 U.S. wasted a 15-point lead in the first half, didn't trail until the final moments of regulation, needed two free throws from Jayson Tatum with one-tenth of a second left just to get into overtime, came back from five points down in the extra session and -- if all that wasn't enough -- needed Turkey to go 0 for 4 from the foul line in the last 9 seconds.
"It means a lot. It means a lot, man," U.S. guard Kemba Walker said.
Dogus Balbay missed a pair following an intentional foul with the U.S. down one, and Cedi Osman missed two more about a second later. Those misses by Osman set up the last U.S. possession, one where Tatum controlled a rebound, brought the ball down and found Middleton for a drive to the rim. Tatum went down, spraining his left ankle on the play.
The U.S. didn't go down with him.
Middleton made both, Ersan Ilyasova missed a jumper for Turkey as time expired and the U.S. survived.
"It really hurts," Turkey's Furkan Korkmaz said. "I think it was in our hands -- not their hands."
Middleton led the U.S. with 15 points. Walker, who single-handedly accounted for the rally from down five, scored 14. Tatum finished with 11 points and 11 rebounds.
Ilyasova led Turkey with 23 points. Melih Mahmutoglu had 18, Furkan Korkmaz scored 16 and Osman added 15 for Turkey -- which was within a hair of one of the biggest wins in its basketball history, on a night when it seemed like all 18,000 whistling and hooting fans at the Shanghai Oriental Sports Center were in their favor.
"I need mental strength to overcome this," Turkey coach Ufuk Sarica said.
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.
And they clinched a spot in the second round -- though that seemed ancillary.
"We capped it off at the end," U.S. center Myles Turner said. "All that matters. JT, Kemba, Khris, a lot of guys made big plays down the stretch."
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.
"JT, that kid is 21 years old, man," Walker said of his Boston teammate. "He was huge for us."
The U.S. led 41-26 in the second quarter when Turkey got a spark from a guard -- from 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. 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.
The U.S. lead was 46-41 at the break, Turkey tied the game in the third quarter, and it stayed tight the rest of the way.
"Every team wants to beat us," Turner said. "Every team will give us their best shot. But more than anything, we stick together."
U.S.: Jason Williams, the point guard on Miami's 2006 NBA title team, was in the stands. ... The U.S. won despite shooting 35 percent. ... USA Basketball said it was the first time a roster with NBA players was taken to overtime since a win over Brazil in the 2001 Goodwill Games.
Turkey: The loss dropped Turkey to 21-8 in its last 29 World Cup games. ... Wilbekin had faced U.S. players before -- in college at Florida he played against Harris (Virginia) and Middleton (Texas A&M), and in the 2015 NBA preseason for Philadelphia he faced Harris (then with Cleveland) and Brook Lopez (then with Brooklyn).
The U.S. is now 3-0 against Turkey, after matchups in each of the last three World Cups. The Americans endured a raucous home crowd to beat Turkey 81-64 in the gold-medal game of the world championships at Istanbul in 2010, then rallied from a five-point halftime deficit to beat Turkey 98-77 in the second game of the 2014 World Cup.
Jeremy Lin, who signed last month with the Beijing Ducks to continue his career after playing for eight NBA teams in a span of nine seasons, was at the game. Lin is best remembered for the "Linsanity" stint with the New York Knicks that vaulted him to temporary stardom, as well as getting an NBA title last season with the Toronto Raptors.
U.S.: Faces Japan on Thursday in Shanghai.
Turkey: Faces the Czech Republic on Thursday in Shanghai.