In energy internet, electric power infrastructure is integrated with cyber infrastructure, which makes power grid vulnerable to cyberattack. Specially, when intruders know the configuration of the target power system, false data injection attacks can be successfully launched to bypass the traditional residual- based bad data detection system. In the presence of this dilemma, this paper aims to design a more robust and useful real- time false data injection attack detection mechanism applied in the supervisory control and data acquisition (SCADA) system in smart grid. Noticing the low dimensionality of temporal measurements of power grid states as well as the sparse nature of malicious attacks, robust principal component analysis (RPCA) is applied to false data injection attack detection in power grid and low- rank matrix fitting (LMaFit) is chosen as the solving algorithm. However, conventional RPCA is an offline method which confines its application, to meet the real- time requirement of power grid attack detection, by use of low- rank projection matrix, an online RPCA based detection mechanism is proposed, which returns detection results immediately as soon as new power grid measurements arrive and needs less computing time and storage space. Experiments on the SCADA test bed show that the proposed online RPCA based detection method works well and its performance on detecting and computing is better than the previous online PCA based method. Specially, the detection sensitivity of the proposed algorithm is 4 orders of magnitude higher than online PCA, and the calculation speed is improved by 2 to 3 orders of magnitude compared to offline RPCA.