The mask-clad faithful for the most part adhered to social distancing guidelines as they sat in designated areas of Reihanat Al Hussein Mosque, in west Tehran.
Clutching their own prayer mats and Korans, they showed up with their families, including a couple with a baby, and appeared to be in high spirits.
Worshippers spilled out into grounds outside the mosque were disinfected by a sanitary worker in a hazmat suit who sprayed them as he walked among them.
But some of the gaps between those seated at the back appeared to be too close for comfort, and the Basij militia was on hand to ensure they kept apart.
"Of course, everybody is worried about the disease, even my own family," said one of the worshippers who gave his name only as Mahmoudi.
"When I decided to come they were concerned about me and I promised them to respect the directives," he said.
"So I came and saw that everyone is respecting the [social] distancing, otherwise, I wouldn't have stayed and I'd have gone back home."
Iran reopened the mosques for two hours from midnight for Laylat Al Qadr, a high point during the fasting month of Ramadan that marks when the Koran was revealed to Prophet Mohammed.
The Islamic republic shut its mosques and shrines in March as part of its efforts to contain the Middle East's deadliest outbreak of COVID-19.
The first cases emerged in the Shiite holy city of Qom on February 19 and spread rapidly to all 31 of the country's provinces.
It has gone on to claim nearly 6,800 lives in Iran.
'Special ceremony'
President Hassan Rouhani, whose government has faced criticism for being slow to react to the crisis, praised worshippers for abiding by health guidelines.
"There were concerns about how people would follow health guidelines if mosques were opened, but last night, you found that it was a special ceremony," he said on Wednesday.
"Wherever people participated, they followed all the instructions," he said in televised remarks.
Health Minister Saeed Namaki had sounded a note of caution on Tuesday as he announced the special reopening for three out of the next five nights.
And on Wednesday he admitted it had been a "difficult and risky decision... criticised by some of my colleagues".
"Everywhere people observed the instructions, except in one county where, contrary to our protocols, tea was offered to the participants," he said.
Health ministry spokesman Kianoush Jahanpour said another 50 people died of coronavirus and 1,958 were infected in the previous 24 hours, taking the overall tolls to 6,783 dead and 112,725 infected.
The Qadr ceremony lasts three nights because the exact time of the revelation of the words of God is unknown.
Those at the first gathering overnight at Tehran's Al Hussein Mosque appeared to be exalted at the chance to finally pray after being shut out for more than two months.
"We have brought masks and gloves and everything. I think that if we follow the security and health protocols, then nothing will happen to us and we will be able to continue with this ceremony," said Masoumeh, a housewife.
For Amir Hosein, a private sector worker, it was a chance not to be missed.
"These nights are special for people and I think the government wasn't able to cancel these ceremonies because we go out and pray together: that is the whole joy of this ceremony."