Before the Friday prayers, Turkish President Recep Tayyip Erdoğan recited from the Quran inside the reopened mosque, choosing from both the Surah Al-Fatihah and the Surah Al-Baqarah.
Later, four muezzins from the mosque's four minarets recited the adhan, or call to the prayer, and the people started the Friday prayers.
Besides being a working mosque, Hagia Sophia is also among Turkey's top tourism destinations for domestic and foreign visitors.
In 1985, during its time as a museum, Hagia Sophia was added to the UNESCO World Heritage List.
It served as a church for 916 years until the conquest of Istanbul, and a mosque from 1453 to 1934-nearly 500 years-and most recently as a museum for 86 years.
Erdoğan and other Turkish leaders had long advocated its restoration to a working mosque, open for worship.
On July 10, a Turkish court annulled a 1934 Cabinet decree that turned Hagia Sophia into a museum, paving the way for its use as a mosque.