This paper introduces a new approach that addresses data contamination problems from attacks in unattended wireless sensor networks. We propose a sliding-window based spatio-temporal correlation analysis called “Abnormal Relationships Test (ART)” to effectively detect, respond and immune to inserted spoofed data from both various-ID impersonators and compromised nodes. Also a systematic approach is given to identify the appropriate sliding window size and correlation coefficient threshold. Our study shows that correlation property of observed phenomenon is not always transitive, different phenomenon from same set of nodes at the same or different period of time can have different correlation coefficients. Our simulation results reveal interesting relationships of outlier percentage and correlation coefficient. With proper parameter setting ART achieves high attack detection rate (90% for correlated attacks and 94% for random attacks even with 100% data insertion).