Based upon cognitive radio technology, we propose a new Machine-to-Machine (M2M) communications paradigm, namely Cognitive M2M (CM2M) communication. We first motivate the use of cognitive radio technology in M2M communications from different point of views, including technical, applications, industry support, and standardization perspectives. Then, our CM2M network architecture and cognitive machine model are presented and the CM2M systems coexistence in TV white spaces is discussed. After that, a CM2M communications architecture for the smart grid is presented, for which we also propose an energy-efficiency driven spectrum discovery scheme. Numerical results demonstrate significant energy saving and the reliability in supporting data transmissions in the smart grid.