In the smart grid, bidirectional information exchange among customers, operators, and control devices significantly improves the efficiency of energy supplying and consumption. However, integration of intelligence and cyber systems into a power grid can lead to serious cyber security challenges and makes the overall system more vulnerable to cyber attacks. To address this challenging issue, this article presents defense mechanisms to either protect the system from attackers in advance or detect the existence of data injection attacks to improve the smart grid security. Focusing on signal processing techniques, this article introduces an adaptive scheme on detection of injected bad data at the control center. This scheme takes the power measurements of two sequential data collection slots into account, and detects data injection attacks by monitoring the measurement variations and state changes between the two time slots. The proposed scheme has the capability of adaptively detecting attacks including both non-stealthy attacks and stealthy attacks. Stealthy attacks are proved impossible to detect using conventional residual- based methods, and can cause more dangerous effects on power systems than non-stealthy attacks. It is demonstrated that the proposed scheme can also be used for attack classification to help system operators prioritize their actions to better protect their systems, and is therefore very valuable in practical smart grid systems.