An electrocardiogram (ECG or EKG) is a highly effective, noninvasive test that detects various heart problems by recording the heart's electrical activity. It can identify arrhythmias (irregular heartbeats), structural abnormalities, and evidence of current or past heart attacks, often acting as a primary tool for diagnosing cardiovascular issues.