In this paper, we propose a novel joint routing and medium access control (MAC) protocol with traffic-differentiation, based on quality of service (QoS) for wireless sensor networks (WSNs). This is referred to as joint routing and MAC (JRM) protocol. By leveraging the classical layered approach and combining routing and MAC layer functions, the proposed JRM protocol achieves a solution for energy efficiency in WSNs. JRM also ensures low latency for prioritized traffic. There are three major advantages of the proposed protocol. Firstly, the instantaneous network information (e.g., estimated time to destination, and node's unavailability to forward additional packet) is piggy-backed with the control packets acknowledgement and clear-to-send of the MAC frame. Based on the updated network knowledge and the objective of the required performance metrics (e.g., energy and latency), the next hop neighbor is chosen dynamically with reduced control overhead. Secondly, the JRM protocol introduces an approach for finding the constrained shortest path for forwarding packets, which results in load balancing in WSNs. Finally, routers (nodes) in JRM require very little forwarding and routing table information, which is compatible with the resource constraints in WSNs. The efficiency of the proposed protocol is shown through simulation results.