The smart grid is one of the most significant applications of the Internet of Things (IoT). As information and communication technologies (ICT) developed and applied in traditional power systems, the improvement of smart grid cyber-physical-systems (CPS) increases too. IoT-based smart grid systems are critical infrastructures, also they have complex architectures and include critical devices. They contain communication systems that can lead to national security deficits, disruption of public order, loss of life or large-scale economic damage when the confidentiality, integrity, or availability of the communication is broken down. These huge systems may be vulnerable to cyber-attacks. Therefore, there is a lot of research effort to enhance smart grid security in industry, government, and academia. The security approaches are important to improve solutions against cyber-attacks in smart grid applications. We present a comprehensive survey supported by a wide review of earlier work. Additionally, recent advances and countermeasures are presented on smart grid cyber-security. In this paper, the threats and potential solutions of the IoT-based smart grid are analyzed. We focus on cyber-attack types and provide an in-depth of the cyber-security state of the smart grid. Particularly, we concentrate on the discussion and examination of network vulnerabilities, attack countermeasures, and security requirements. We aim to supply a deep understanding of cyber-security vulnerabilities and solutions and give a guide on future research directions for cyber-security in smart grid applications.