The mating system of the gobiid fish Trimma grammistes as well as bidirectional sex change in the species was investigated in Ito Beach, Chiba, Japan. Sixty-seven individuals appeared in the study area. The sex ratio in T. grammistes was femalebiased (22:45), and there was no significant difference between the total length of males and females. They formed social groups that consisted of one or two males and some smaller females. The largest individual in a group was always male. All aggressive behaviors were performed by the largest individuals in each social group regardless of their sex. The largest males monopolized all mating opportunities. These results indicated that the mating system of T. grammistes was harem polygyny. In some groups, however, small males existed. The reproductive status of small males (regardless of whether the small male had reproductive ability and opportunity) remained unclear. Two and three instances of female-to-male and male-to-female sex change were observed during the study period, respectively. In addition, we confirmed that one individual changed sex from female to male and vice versa. Most of these sex changes were observed when the social status had fluctuated; e.g., a large male had disappeared or newly joined the group. Therefore, the ability to undergo sex change in this species might evolve to maximize reproductive success in the harem polygyny, and corresponds well with the prediction of the size-advantage model.