Currently, working in the overcrowded shared unlicensed spectrum band, leads to a reduction in the quality of communications in wireless networks. This makes a considerable increase in packet loss caused by collisions that necessitates packets retransmissions. In the case of wireless sensor networks (WSN), a large amount of energy of sensor nodes will be wasted by these retransmissions. Cognitive radio technology makes it possible for sensor nodes, to opportunistically use licensed bands with better propagation characteristics and less congestion. In this paper a routing method for cognitive radio wireless sensor networks (CR-CEA) is presented, that is based on a cross-layer design that jointly considers route and spectrum selection. The CR-CEA method has two main phases: next hop selection and channel selection. The routing is performed hop-by-hop with local information and decisions, which are more compatible with sensor networks. Primary user activity and prevention from interference with them, is considered in all spectrum decisions. It uniformly distributes frequency channels between adjacent nodes, which lead to a local reduction in collision probability. This clearly affects energy consumption in all sensor nodes. In CR-CEA, route selection is energy-aware and a learning-based technique is used to reduce the packet delay in terms of hop-count. The simulation results reveal that by applying cognitive radio technology to WSNs and selecting a proper operating channel, we can consciously decrease collision probability. This saves energy of sensor nodes and improves the network lifetime.