An electrocardiogram (ECG) is a test that measures the electrical activity of the heart over a period of time. It is crucial for diagnosing various cardiac conditions such as arrhythmias, myocardial infarction, and other heart diseases. By interpreting the ECG, nurses can identify abnormalities in heart rhythms, ensuring timely intervention and treatment.