The rapid growth of the Internet of Things (IoT) technologies has generated a huge amount of traffic that can be exploited for detecting intrusions through IoT networks. Despite the great effort made in annotating IoT traffic records, the number of labeled records is still very small, increasing the difficulty in recognizing attacks and intrusions. This study introduces a semi-supervised deep learning approach for intrusion detection (SS-Deep-ID), in which we propose a multiscale residual temporal convolutional (MS-Res) module to finetune the network capability in learning spatiotemporal representations. An improved traffic attention (TA) mechanism is introduced to estimate the importance score that helps the model to concentrate on important information during learning. Furthermore, a hierarchical semi-supervised training method is introduced which takes into account the sequential characteristics of the IoT traffic data during training. The proposed SS-Deep-ID is easily integrated into a fog-enabled IoT network to offer efficient real-time intrusion detection. Finally, empirical evaluations on two recent data sets (CIC-IDS2017 and CIC-IDS2018) demonstrate that SS-Deep-ID improves the efficiency of intrusion detection and increases the robustness of performance while maintaining computational efficiency.