A vehicular ad-hoc network (VANET) is among the communication networks classified as a subset of the Internet of things (IoT). In fact, it is considered as an effective solution to smartification of transportation systems and prevention of traffic collisions. The pervasiveness and wireless nature of communications in a VANET can provide a good opportunity for the presence of intruders and malicious users. However, the slightest disruption in the performance of this network can jeopardize people’s lives. This study aims to propose an intrusion detection system based on the cross-layer approach through supervised machine learning techniques to confront jamming and spoofing attacks in VANETs. For this purpose, 31 detection systems are developed and analyzed by combining five features (ie, SINR, RSSI, speed, distance, and network congestion) and decision systems including decision tree, SVM, and K-NN algorithms. The proposed detection system can correctly classify and detect test data through the decision tree, SVM, and K-NN algorithms with approximate accuracies of 98%, 97%, and 96.67%, respectively. Moreover, considering the detection time, decision tree is selected as the fastest detection algorithm. Finally, this study proposes a lightweight intrusion detection system with an approximate accuracy of 98% by integrating three features of speed, distance and network congestion to detect jamming and spoofing attacks in a VANET.