Rio de Janeiro - It took the 2016 U.S. Olympic Men’s Basketball Team (3-0) nearly all four quarters to pull away from previously unbeaten Australia (2-1) on Wednesday night at Carioca arena in Rio de Janeiro. The USA recorded a 98-88 win but led by just five points, 85-80, with 3:57 remaining in the game.

Carmelo Anthony, who became the all-time leading scorer in U.S. men’s Olympic history (293 points), led the USA with 31 points, including 9-of-15 shooting from 3-point, and eight rebounds, and it was his ninth 3 that kicked off the USA’s 13-8 closing run that helped secured the victory.

Anthony’s 31 points tied for the second-highest, single-game output in the U.S. men’s Olympic record book, and his 15 3-point attempts set the record.

“We beat a heck-of-a team,” said USA head coach Mike Krzyzewski. “Australia has probably played the best of anybody in the Olympics. They played three really tough opponents, us being the third one. They just play lights-out basketball. They play so well together as one, and they’ve been together. For a lot of times on the court tonight, they had four guys who started against us in London. But they play as one, and for us, I thought it was a heck-of-a win, first of all because we beat a really good team, an outstanding team that was playing really well.

“For this group, that’s the first real, real international game we’ve had. The experience of playing in that. The exhibitions were played in America. The first two games we were significantly better than those teams. This is the real world now. That was good for us. I thought the defense we had the second half was so much better than the first half. And guys stepped up. Carmelo was magnificent. We earned the win, and we’re going to have to earn our wins throughout. So, this was a really good night for us.”

Anthony made two 3-pointers to put the Americans ahead 6-0 to start the game, but Australia rode an 8-0 streak to lead 13-9 just 2:35 seconds into the game. Anthony scored with 5:37 on the clock to pull the USA within one, 18-17, but Australia reeled off seven points and led 25-17 with 3:36 remaining in the first period. A 3 from Klay Thompson helped ignite the USA, which closed the quarter by outscoring Australia 12-4 to even the score at 29-29 after the first 10 minutes. Anthony made four 3s in the first quarter alone.

After points from Kevin Durant, Kyrie Irving and DeMarcus Cousins to start the second quarter, the USA led 36-31, but again Australia responded and scored 10 consecutive points to lead 41-36 when Patty Mills made a long-ball with 5:52 on the clock. The USA interrupted the run, but Australia went ahead by seven points, 46-39, 1:50 later. With Draymond Green and Anthony connecting from deep at the end of the first half, the USA headed to the locker room trailing at halftime for the first time since the 2004 Olympics, 54-49.

The USA was 10-of-21 from 3-point (.476) in the first half but struggled inside the arc, where it was just 7-of-25 (.280). Meanwhile, Australia was 19-of-28 from the field (.679), including 5-of-8 from 3-point (.625).

“We kind of expected kind of a game like this, physical game, grind-out game from playing against Australia over the past couple of years,” Anthony said. “Coming into tonight, knowing what type of team they are, knowing the type of players they have on the team, we knew it was going to come down to the end of the game where we really had to buckle down and focus in and make plays down the stretch.”

The USA started off the third quarter with a 9-0 run and led 58-54 at 7:40. From there, however, the score was tied four times as neither team could pull away. A three-point play from Green 32.2 seconds before the end of the period gave the USA a 70-67 lead headed into the final 10 minutes.

Australia took its final lead of the game at the start of the fourth, 72-70, and it was Anthony who gave the USA back the advantage for good with five points to put the red, white and blue ahead 75-72 with 7:37 on the clock. That included the first of four 3s for Anthony in the fourth quarter, while Irving was the USA’s other top closer with 10 of his 19 points in the final 10 minutes. Between Anthony and Irving, the USA had an answer for every Australia score, and Durant, who finished with 14 points, sealed the win with the last two points from the free throw line.

Australia, which was led by 30 points from Mills, shot 50.0 percent from the field (33-66 FGs) and 33.3 percent from 3-point for the game but was an icy 1-of-7 from 3 (.143) in the fourth quarter.

The USA, which finished the game 39.1 percent from the field (34-87 FGs) and 43.6 percent from behind the arc (17-39 3pt FGs), converted 17 Australian turnovers into 23 points, grabbed 21 offensive rebounds, which led to 23 second-chance points, and outrebounded Australia 47-40 overall.

“I feel like we needed a test like that to prepare for what’s ahead of us,” Irving said. “We definitely took some steps in the right direction and building our character and identity as a team. They really challenged us offensively and defensively, but we had a very resilient attitude. When you have a resilient group like this with tons of talent, when you are facing adversity, it makes it easy to come out of it.”

Also today in Group A action, France (2-1) edged past Serbia (1-2) 76-75, while Venezuela (0-2) and China (0-2) will play at 9:30 p.m. (EDT).

The U.S. men continue preliminary round play against Serbia at 6 p.m. (EDT) on Aug. 12 and a final preliminary round game against France at 1:15 p.m. (EDT) on Aug. 14.

The top four finishing teams from each preliminary round group advance to the quarterfinals on Aug. 17.