In this paper, we proposed a classification method based on a nature-inspired algorithm, i.e., modified artificial bee colony (MABC). This method was applied to electrocardiogram (ECG) heartbeat classification. ECG data was obtained from MITBIH database. Eight different types of heartbeats (N, j, V, F, f, A, a, and R) were analyzed. For a better classification result, both time domain and frequency domain features were used. Feature selection was done by divergence analysis. MABC classification accuracy and heartbeat sensitivity values were compared with the results of other methods. Among other classifiers, k-nearest neighbor (KNN), Kohonen's self-organizing map (SOM), and ant colony optimization (ACO) were the best performing ones, and therefore their results are presented. The MABC classifier achieved 97.18% accuracy on the analyzed dataset, as well as high sensitivity values for heartbeat types.