The South Korean women's basketball team secured the gold medal by defeating Japan in a closely contested final in Nagoya.