Nowadays, cyber attacks are becoming an extremely serious issue, which is particularly important to prevent in a smart city context. Among cyber attacks, spoofing is an action that is increasingly common in many areas, such as emails, geolocation services or social networks. Identity spoofing is defined as the action by which a person impersonates a third party to carry out a series of illegal activities such as committing fraud, cyberbullying, sextorsion, etc. In this work, a face recognition system is proposed, with an application to the spoofing prevention. The method is based on the Histogram of Oriented Gradients (HOG) descriptor. Since different face regions do not have the same information for the recognition process, introducing entropy would quantify the importance of each face region in the descriptor. Therefore, entropy is added to increase the robustness of the algorithm. Regarding face recognition, our approach has been tested on three well-known databases (ORL, FERET and LFW) and the experiments show that adding entropy information improves the recognition rate significantly, with an increase over 40% in some of the considered databases. Spoofing tests has been implemented on CASIA FASD and MIFS databases, having obtained again better results than similar texture descriptors approaches.