H. Mustafayev was born in 1932 in Baku. In 1956 he graduated from the Faculty of Geology of Moscow State University. He studied postgraduate studies at the Institute of Mineralogy, Geochemistry, Crystallochemistry of Rare Elements in Moscow.
In 1965 he became a Doctor of Philosophy, and in 1975 - Doctor of Geological and Mineralogical Sciences, Professor. In 2001 he was elected a corresponding member of the Azerbaijan National Academy of Sciences (ANAS).
H.Mustafayev worked in production facilities of the Ministry of Geology of the USSR in Kyrgyzstan and Azerbaijan in 1956-1960. In 1963 he started working at the Institute of Geology of the AAS (now the Institute of Geology and Geophysics). H. Mustafayev is a prominent expert in the fields of metallogeny, geochemistry and petrology. He has developed statistical, mineralogical and geochemical studies to address the petrology and metallogeny of magnetic forms, and has done fundamental research on the mesozoic granitoid complex. His scientific prediction was confirmed by the discovery of a new copper-porphyry ore industry in the northeastern part of the Lesser Caucasus. He is one of the authors of the modern classification of the Azerbaijani Magnetic Forms, a new classification of the Magnetic and Metamorphic Map of Azerbaijan, published in 1979 with a new method. H. Mustafayev has developed a new classification of the ore regions of Azerbaijan, developed mineral-geochemical criteria for the exploration of deposits, worked on theoretical justification of the possibility of forecasting and exploring resources of copper, tin and several other metals in various metallogenic zones of the country.
H. Mustafayev is an author of more than 120 scientific works of, including 5 monographs (3 co-authors). He headed the Department of Metallogeny of the Institute of Geology of ANAS.
In 1991, Mustafayev was named the Honored Geologist of Azerbaijan.
Corresponding member of ANAS Hamid Mustafayev died in 2011 in Baku.