Rio De Janeiro - The 2016 U.S. Olympic Men’s Basketball Team (7-0) led the entire 40 minutes and fought its way to an 82-76 win over Spain (4-3) to advance to the gold medal game of the 2016 Olympic Games on Friday afternoon at Carioca Arena 1 in Rio de Janeiro. The win extended the U.S. men’s Olympic win streak to 24-games.

The U.S. defeated Spain in the 2008 and 2012 Olympic gold medal games, but in 2016 it will face Serbia (5-2), 87-61 winner over Australia (5-2) in tonight’s second semifinal. Spain and Australia will meet in the bronze medal game at 10:30 a.m. (EDT) on Aug. 21.

Klay Thompson led the USA with 22 points and three assists, while DeAndre Jordan collected a U.S. men’s Olympic record-tying 16 rebounds to go with nine points and four blocked shots.

While the USA never trailed in the contest, it also never had complete control of the game. The Americans were helped to the win by a 53-41 rebounding advantage that led to 25 second-chance points and a defensive effort that held Spain to 38.9 percent from the field (28-72 FGs) and 30.8 percent from 3-point (8-26 3pt FGs).

“We knew when we first started training camp that there was a great, great chance that we were going to play Spain at some point,” said USA head coach Mike Krzyzewski. “We’ve had some great, great games against Spain, some unbelievably competitive games. We expected the same today, and we got it. It was a different type of a game. It was a very hard game and both teams had to … it wasn’t easy flowing, and both teams had to make big plays. I thought our guys did that a little bit more than they did, and that’s why we won.”

Eight U.S. players scored in the first quarter, led by seven points from Kevin Durant, who finished with 14 points. The USA was helped by a 16-6 rebounding advantage in the first 10 minutes and took a 26-17 lead at the end of the first period.

The USA went ahead by 10 points early in the second, but Spain mounted a 7-0 run to cut it to three points, 33-30 when the USA called a timeout with 3:40 remaining. Thompson scored the USA’s next three points to push the lead to 36-30, and the teams traded baskets from there to head to the halftime locker room with the USA leading 45-39. Thompson heated up in the second quarter to score 12 points.

The tightly contested game saw six technical fouls called in the second quarter, including on Spain’s bench, coach Sergio Scariolo, Felipe Reyes and the fourth foul on Nikola Mirotic. For the U.S., Paul George and Durant earned technical fouls.

“(Spain is) such a tough team, and they have so many great players, and guys who’ve been together for years, experienced players internationally and in our league back home” Jordan said.

“But tonight was great. I think everybody contributed as much as they really could. It was an up and down, funny game, but ultimately we came out and we got stops when we needed to get stops, we converted on the offensive end when we needed to get a bucket. We just have to continue to do the same thing on Sunday, and we’ll be fine.”

The USA worked its way back to a double-digit lead after a three-point play from Carmelo Anthony to make it 53-43 after 3:40 played in the second half, but each time the USA seemed to pull away, Spain responded.

Spain narrowed the score to five points with a 3 at 5:31, before the USA outscored Spain 8-2 to lead 61-50 when Jordan slammed home an offensive rebound with 3:44 on the clock. Spain narrowly outscored the USA 7-5 in the last few minutes of the third quarter, and the USA led 66-57 entering the fourth period.

“We wanted them to take tough 2s, we wanted them to shoot the ball being uncomfortable with a hand in their face,” Anthony said. “No uncontested shots. We did that. We stayed home on the 3s. They penetrated, we wanted DeAndre to kind of clean that up. He did a hell of a job doing that for us.”

The USA created some breathing room with scores from Kyrie Irving, George and Kyle Lowry to start off the fourth with a 6-0 stretch that gave the USA its largest lead of the game, 15 points (72-57) with 7:27 left. Spain cut the margin back to 10 points, but Thompson and Irving sank 3-pointers, and the U.S. lead was 78-65 with 4:23 remaining. Spain closed the game by outscoring the USA 11-4, but the surge was too little too late, and the USA held on for an 82-76 victory.

Irving added 13 points and five rebounds.

Spain’s Pau Gasol was the game’s leading scorer with 23 points.

“When the stakes are the highest is when we all play the best, and there won’t be any higher (stakes) than on Sunday,” Thompson said of the gold medal game. “Expect a great effort from all of us.”

The U.S. men now boast of a 137-5 all-time record in Olympic play and have won a medal in 14 of the 17 Olympic men’s basketball competitions in which they have competed.