Internet of things (IoT) devices may be easily compromised and incapable of defending and securing themselves due to resource constrained nature. Hence, the integration of devices with resource rich pool such as fog is required. This integration provides expected growth in delay sensitive IoT applications. In this context, authentication plays a vital role. In this paper, we propose a new and anonymous mutual authentication protocol for fog enabled IoT based on elliptic curve cryptography. The proposed protocol achieves mutual authentication between a device and the fog server with the help of cloud server called three-way authentication procedure. Security analyses of the proposed protocol show that it is robust against several attacks. Moreover, the performance of the proposed protocol has been evaluated and compared with other related protocols in terms of communication and storage cost. Security analyses and performance analyses found that the proposed authentication protocol attains better security than related protocols.