The evolutionary history of sexual selection in the geologic past is poorly documented based on quantification, largely because of difficulty in sexing fossil specimens. Even such essential ecological parameters as adult sex ratio (ASR) and sexual size dimorphism (SSD) are rarely quantified, despite their implications for sexual selection. To enable their estimation, we propose a method for unbiased sex identification based on sexual shape dimorphism, using size-independent principal components of phenotypic data. We applied the method to test sexual selection in Keichousaurus hui, a Middle Triassic (about 237 Ma) sauropterygian with an unusually large sample size for a fossil reptile. Keichousaurus hui exhibited SSD biased towards males, as in the majority of extant reptiles, to a minor degree (sexual dimorphism index 20.087). The ASR is about 60% females, suggesting higher mortality of males over females. Both values support sexual selection of males in this species. The method may be applied to other fossil species. We also used the Gompertz allometric equation to study the sexual shape dimorphism of K. hui and found that two sexes had largely homogeneous phenotypes at birth except in the humeral width, contrary to previous suggestions derived from the standard allometric equation.