Spain beat Australia to reach Basketball World Cup final