Medical professionals diagnose muscle spasms based on the patient's symptoms and medical history. The relevant ICD-10 codes are used to categorize the condition for record-keeping and insurance purposes.