Vehicular Ad-hoc Network (VANET) is a modern era of dynamic information distribution among societies. VANET provides an extensive diversity of applications in various domains, such as Intelligent Transport System (ITS) and other road safety applications. VANET supports direct communications between vehicles and infrastructure. These direct communications cause bandwidth problems, high power consumption, and other similar issues. To overcome these challenges, clustering methods have been proposed to limit the communication of vehicles with the infrastructure. In clustering, vehicles are grouped together to formulate a cluster based on certain rules. Every cluster consists of a limited number of vehicles/nodes and a cluster head (CH). However, the significant challenge for clustering is to preserve the stability of clusters. Furthermore, a secure mechanism is required to recognize malicious and compromised nodes to overcome the risk of invalid information sharing. In the proposed approach, we address these challenges using components of trust. A trust-based clustering mechanism allows clusters to determine a trustworthy CH. The novel features incorporated in the proposed algorithm includes trust-based CH selection that comprises of knowledge, reputation, and experience of a node. Also, a backup head is determined by analyzing the trust of every node in a cluster. The major significance of using trust in clustering is the identification of malicious and compromised nodes. The recognition of these nodes helps to eliminate the risk of invalid information. We have also evaluated the proposed mechanism with the existing approaches and the results illustrate that the mechanism is able to provide security and improve the stability by increasing the lifetime of CHs and by decreasing the computation overhead of the CH re-selection. The StabTrust also successfully identifies malicious and compromised vehicles and provides robust security against several potential attacks. INDEX TERMS Intelligent transport system, security, vehicular ad-hoc networks, trust-based clustering, VANET attacks.