EEG is primarily used to diagnose neurological conditions that affect brain activity, such as epilepsy, sleep disorders, and encephalopathies. By measuring electrical activity in the brain, EEG can help identify abnormal patterns that indicate these conditions, aiding in precise diagnosis and treatment planning.