Crowds gathered in Istanbul as the historic Hagia Sophia site opened for Friday prayers for the first time since Turkish authorities ruled it could be converted into a mosque.
Clerics in white robes sang from the Koran. Mosaics and frescoes of Jesus and Mary were draped with curtains.
The 1,500-year-old Unesco World Heritage site became a museum in 1934.
This month a Turkish court annulled its status, saying any use other than as a mosque was "not possible legally".
The decision to turn it back into a mosque was criticised by religious and political leaders worldwide.
But President Recep Tayyip Erdogan responded quickly to the ruling, vowing that the world-famous site would be ready for Friday prayers from 24 July, and he was seen joining worshippers at around midday (09:00 GMT).
About 1,000 people were allowed in through security checkpoints, while others laid out prayer mats outside. An opening ceremony was followed by a formal prayer service and proceedings were relayed outside on a big screen. Four muezzin recited the call to prayer from each of the four minarets.