Apple will be the first company to allow consumers to give themselves an electrocardiogram, a medical test used to detect heart disease.

On Wednesday, the company announced the new feature on the Apple Watch Series 4 during Apple's fall product introduction at its headquarters in Cupertino, California.

Now playing:Watch this:
Apple adds EKG monitoring to new Watch 4

3:13

Apple has added electrodes to the redesigned Apple Watch, which can measure the electric activity in the heart to detect heart diseases and irregular heartbeats that could lead to heart attacks and strokes.

It's a major step for Apple, which has been pushing the boundaries of its Apple Watch beyond fitness so the wearable can be used more as a health or medical device. Previous versions of the Apple Watch could already measure heart rates, but the technology often produced inaccurate readings.

Here's how it works. Users put their finger on the digital crown. A current then passes across the chest, which directly tracks the electrical signals in the heart. The process takes about 30 seconds and users immediately receive notice of a "sinus" rhythm if the heart is beating normally. The Apple Watch can also classify irregular rhythms, such as atrial fibrillation. The information is encrypted and stored as a PDF in the Apple Health app. Users can then share the info with doctors.

Dr. Ivor Benjamin, a cardiologist who heads up the American Heart Association, was on hand at the event to endorse the new feature. He applauded Apple's "innovation and commitment to health." He called the new EKG feature game-changing in giving physicians access to health data in real time that they may not be able to capture when conducting tests in a clinical setting.

"Products that seek to provide deeper health insights like the Apple Watch Series 4 offer great potential," Benjamin said.

Apple said the EKG feature will be available later this year in the US. It hopes to make the feature available to other countries around the world.

The Apple Watch Series 4 starts at $399 for the aluminum version, and $499 for the aluminum version with cellular features. Preorders are scheduled to start Friday, and the device should be available Sept. 21.