Narrowband Internet of Things (NB-IoT) is becoming one of the most promising low power wide area (LPWA) networking technologies. It can support more than 50 000 devices within a cell using licensed spectrum. NB-IoT provides low energy consumption, reliable connectivity and deep indoor coverage for the device, making it a good candidate for IoT use cases. NB-IoT introduces two novel energy-saving techniques, namely extended discontinuous reception (eDRX) and power saving mode (PSM). This paper presents a Markov chain model to evaluate the power consumption and latency of NB-IoT devices using PSM and eDRX. By exploiting the characteristics of the steady-state distribution of the Markov chain, the probabilities in steady state can be obtained explicitly. Based on these probabilities, we calculate the system downlink (DL) latency as a function of different timers of these power-saving features. We also compare the model to simulation results obtained from the ns-3 event-based network simulator, to determine its accuracy. The results show that its performance in terms of energy and latency is comparable. Our model is accurate with consideration of the protocol details and the new Radio Resource Control (RRC) Idle features of NB-IoT. The results show that the analytical model achieves an average accuracy of more than 91% for power consumption and DL latency. Lastly, we use the model to automatically determine the optimal parameter set in terms of latency and power consumption for various IoT use cases with different traffic requirements, based on multi-objective analysis of the Pareto front.