The IEEE 802.15.4 standard is poised to become the global standard for low data rate, low energy consumption wireless sensor networks (WSN). By assigning the same sets of contention access parameters for all data frames and nodes, the contention access period (CAP) of the slotted IEEE 802.15.4 medium access control (MAC) currently provides a priorityindependent channel access functionality and no service differentiation. Several recent WSN applications such as wireless body sensor networks, however, may require service differentiation and traffic prioritization support to accommodate potential high priority traffic (e.g., alarms or emergency alerts). By allowing different sets of access parameters and data frame lengths for different priority classes, this paper develops a Markov-chain-based analytical model of the CAP of the IEEE 802.15.4 MAC with service differentiation, under unsaturated traffic conditions. In particular, given two priority classes, our analytical model is used to evaluate the performance of a simple, yet effective, contention-window-based service differentiation strategy, in terms of the resulting throughput, average frame service time and access priority for each priority class. The accuracy of the analytical model is validated by extensive ns-2 simulation.