Malaysian stocks, including Shariah-compliant stocks, have experienced turbulence last year. Although there are defensive stocks, the well-performing ones are not easily identified. Researchers have proposed various metrics to identify defensive stocks. However, most of the approaches require human intervention. In this study, we focus on Shariah-compliant stocks and propose to automate the labeling of stocks in terms of their financial performance via clustering. The study aims to identify the optimal clustering method to label the clusters. This was achieved by first employing k-Means, Agglomerative, and Mean Shift clustering to group similar stocks before labeling. When labeling, the criteria to distinguish well-performing defensive Shariah-compliant stocks were high dividend yield, low price-earnings ratio, low Beta value, and low price-to-book value. After labelling each stock with its financial performance (Low, Medium, High), we performed classification using Logistic Regression, k-Nearest Neighbors, Support Vector Machine, Decision Tree, and Random Forest to verify the credibility of the labels. Based on the results, the clusters created by k-Means clustering outperformed the rest in matching accuracy. Further investigation was conducted on the k-Means data set by dividing the data according to sector and classifying each sector’s data separately. Logistic Regression outperformed other classification algorithms with an accuracy of 71.5%. The findings also suggested accuracy increased when stocks were classified according to sectors. Further considerations include performing outlier analysis on the data to select well-performing stocks.