Studies have shown that osteocalcin is involved in energy metabolism and is sufficient to prevent age-related muscle loss. The present study investigated the association of serum osteocalcin levels with muscle mass and the influence of metabolic factors on this association in humans. A total of 1742 middle-aged and elderly subjects (median age: 61.2 years; interquartile range: 56.9-65.3 years) were enrolled from Shanghai communities, including 775 men and 967 postmenopausal women. Serum osteocalcin levels were measured by an electrochemical immunoluminescence assay. An automatic bioelectric impedance analyser (BIA) was used to measure body compositions. Relative skeletal muscle index (SMI) was calculated using the BIA equation from Janssen etal. SMI was significantly higher in men than in postmenopausal women (37.30% [35.14%-39.63%] versus 27.72% [25.99%-29.66%], p<0.001). Increasing SMI was associated with decreases in the frequency of overweight/obesity, central obesity, dyslipidaemia, elevated blood pressure, and hyperglycaemia (all p<0.001). Serum osteocalcin levels were positively correlated with SMI in both men and women, regardless of treatment as a categorical or continuous variable (all p<0.001). However, after accounting for confounding variables, the relationship remained only in men with hyperglycaemia (standardized β=0.068, p=0.024). Among men with isolated impaired glucose tolerance, the odds ratio of increased SMI was 2.861 in the fourth osteocalcin quartile compared with the lowest (p=0.046). Multiple stepwise regression revealed that each standard deviation (SD) increase of serum osteocalcin levels resulted in an increase of 0.131 SD in SMI (p=0.024). Serum osteocalcin levels were positively related to SMI in men with hyperglycaemia, especially in those with isolated impaired glucose tolerance. No association was detected between serum osteocalcin levels and SMI in postmenopausal women.