By Steve Keating

RIO DE JANEIRO (Reuters) - The United States continued their reign over Spain with a scrappy 82-76 win on Friday to put them through to the gold medal final of the men's basketball tournament for a third straight Olympics.

The Americans will ride a 24-game Olympic winning streak into Sunday's final where they will take on tiny Serbia who will play for gold for the first time as an independent nation.

Serbia stormed to an early lead then held on to rout Australia 87-61 to send the Olympic debutants through to the final.

"Based on this game and also the previous game against the United States, I think we can hope we are going to match up pretty good," said Serb center Miroslav Raduljica. "I think we showed in our last game that they are not unbeatable. I think we know how to play against them."

With the two top-ranked teams, number one U.S. and number two Spain, both packed with NBA talent, the game had the familiar buzz of a gold medal final. The countries met to decide the gold at the previous two Olympics in London and Beijing, with the U.S. coming out on top both times.

"What I would say it was a very hard game," U.S. coach Mike Krzyzewski told reporters. "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."

The United States led from the opening tip-off but were never able to run away from a Spanish squad determined to end decades of frustration that has seen them lose all 12 meetings with the U.S. team on Olympic or world championship hardwood dating back to 1936.

The U.S. held 10-point or more leads in the second, third and fourth quarters but each time Spain would claw their way back into the game, keeping the outcome in doubt although the United States never appeared in danger of losing control.

Klay Thompson, one half of the Golden State Warriors splash brothers with twice NBA most valuable player Stephen Curry, broke out of his Olympic scoring funk in a big way, dropping a team-high 22 points, while Kevin Durant chipped in with 14.

But it was the improved U.S. defensive play, and the work of DeMarcus Cousins on the boards pulling down 16 rebounds, that were singled out for praise.

"To win gold we need to continue to make that effort on the defensive end, and if we play with passion like tonight, we will be tough to beat," Durant told reporters. "On the defensive end tonight and the last two games, we were really good.

"This is where we wanted to be."

It is also where few expected Serbia to be.

While Serbia will be making their first appearance in the gold medal game, they bring a deep basketball pedigree to the final.

As part of the rump of former Yugoslavia, consisting of Serbia and Montenegro, they beat the U.S. in the quarter-finals of the 2002 world championships on the way to the gold, and were beaten for a silver by the Americans at the 1996 Atlanta Games.

(Additional reporting Mary Milliken; Editing by Meredith Mazzilli, Jan Harvey and Bill Rigby)