With the Internet of Things (IoT), the entire physical infrastructure can be closely coupled with information and communication technologies. In a typical IoT architecture, a gateway serves as the mediator which connects the physical devices of an IoT local system to a wide area network. Although the traditional network security mechanisms, such as IPsec, can be applied to protect the wide area network, they are not desirable to the IoT local system, due to their computationally-intensive procedures. In this paper, an efficient security scheme for IoT local systems is presented. The proposed security scheme is comprised of a novel key management protocol, an efficient and secure encryption protocol, and efficient authentication protocols. The security scheme is secure against various attacks, and it is much more efficient than IPsec, thus, it is highly desirable to IoT local systems. The application of the security scheme to clustered sensor networks (a typical IoT application) is studied. The comparison of the security scheme with the existing security mechanism, SecLEACH, shows that the proposed security scheme is more secure and outperforms SecLEACH with regard to network connectivity and efficiency. © 2019 IEEE.