Smart grid (SG) allows for two-way communication between the utility and its consumers and hence they are considered as an inevitable future of the traditional grid. Since consumers are the key component of SGs, providing security and privacy to their personal data is a critical problem. In this paper, a security protocol, namely TPS3, is based on Temporal Perturbation and Shamir's Secret Sharing (SSS) schemes that are proposed to ensure the privacy of SG consumer's data. Temporal perturbation is employed to provide temporal privacy, while the SSS scheme is used to ensure data confidentiality. Temporal perturbation adds random delays to the data collected by smart meters, whereas the SSS scheme fragments these data before transmitting them to the data collection server. Joint employment of both schemes makes it hard for attackers to obtain consumer data collected in the SG. The proposed protocol TPS3 is evaluated in terms of privacy, reliability, and communication cost using two different SG topologies. The performance evaluation results clearly show that the TPS3 protocol ensures the privacy and reliability of consumer data in SGs. The results also show that the tradeoff between the communication cost and security of TPS3 is negligible.