RIO DE JANEIRO — The nail-biters ended Wednesday night for the U.S. Olympic men’s basketball team.

So did a golden era of international basketball.

Emphatically stopping a stretch of three straight close games, the Americans advanced to the semifinals by sprinting past Manu Ginobili and Argentina, 105-78.

In front of a chanting, flag-waving crowd of Argentines who came to throw a raucous farewell party for their Golden Generation, the Americans delivered their most complete performance.

“What a remarkable run by Argentina and so we knew we had to match that energy tonight. I thought we did,” U.S. Coach Mike Krzyzewski said.

Turning a slow start into an early ending with a 27-2 run in the first half, the Americans put away one old rival and set up a meeting with another.

They will play Spain on Friday in a rematch of the last two gold-medal games.

Kevin Durant scored 27 points for the Americans, who played three straight close games for the first time under Krzyzewski, setting off a round of questions about what was wrong.

The answer might be nothing. At least there wasn’t against Argentina.

“We wanted to come out and our whole thing was dominating,” Carmelo Anthony said.

The Americans eliminated Argentina for the third straight Olympics, this time ending not only a tournament run for the Argentines but two careers.

Ginobili, 39, and longtime 36-year-old teammate Andres Nocioni retired from international competition, 12 years after winning gold in Athens.

“We had a chance to grow up together and do some good things, win some games together. It was fun. It’s a lot of years,” said Luis Scola, who is also 36 but plans to keep playing. “We formed part of something unique we did for our country and it’s going to be there. Sometimes we’re not going to win, like today, sometimes we won but we fought together for many years.”

Ginobili scored 14 points in his final game in Argentina’s blue and white, tearing up after receiving applause from his fans and warm wishes from his opponents.

“They congratulated me and I’m very proud of their words,” Ginobili said. “They were very kind, very respectful, and when legends of the game show respect, it has an extra value.”

The Americans have won 23 straight in the Olympics since Argentina beat them in the 2004 semifinals, and this was how they usually do it: too much offense, too much defense, and way too much talent.

It took a little while to get going as Argentina opened a 10-point lead.

The Argentines made nine of their first 10 shots inside the arc and led 19-9 when Nocioni drilled a 3-pointer. But the Americans finished the first quarter with a 16-2 run, getting the final six points from DeMarcus Cousins to take a 25-21 edge to the second.

Three-point plays by Cousins and Jimmy Butler around Durant’s 3-pointer in an 11-0 start to the second made it 36-21 before Facundo Campazzo converted a three-point play for Argentina.

Cousins, the normal starting center playing as a reserve, finished with 15 points.

Spain beat France 92-67 earlier Wednesday, its fourth straight victory after two losses to open the Olympics. The U.S. edged Spain 118-107 in the 2008 final and 107-100 four years ago in London.

The loudest crowd yet for a U.S. game, featuring boxer Floyd Mayweather and NBA Commissioner Adam Silver, watched the Americans open a 25-point lead in the first half.

“We fed off wanting to play better than the last three games,” Durant said.

They were finally in top form Wednesday.

Now they have to stay there two more games.

“We’ve got to build on it,” Durant said, “but we’re not satisfied at all.”