Serbia stormed to an early lead then held on to rout Australia 87-61 on Friday and advance to the gold medal game of the men's Olympic basketball tournament for the first time as an independent nation.

Tiny Serbia will now take on basketball superpower United States on Sunday in a David versus Goliath final.

The only team with a losing record (2-3) to make it out of the group stage, Serbia caught Australia flat-footed, holding the misfiring Boomers to just five points in the opening quarter, then put them in a 35-14 halftime hole they could never escape.

Australia, who had the better of the Serbs in preliminary play, taking a 95-80 win, were simply overwhelmed in the rematch, trailing by as much as 30 in the final quarter.

Milos Teodosic paced Serbia with 22 points while Stefan Markovic had 14.

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 US 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.

At the 2014 World Cup Serbia won their first medal as an independent nation, again taking silver.

In the other semi-final the US continued their reign over Spain with a scrappy 82-76 win 

With the two top-ranked teams, number one US 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 US coming out on top both times.

"What I would say it was a very hard game," US 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 tipoff 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 US team on Olympic or world championship hardwood dating back to 1936.