The mosque is one of several sites where his coffin is expected to be taken before being buried in the holy Shia city of Najaf on Saturday.
Iraqi leaders and other officials had earlier gathered at Baghdad airport to receive al-Hakim's body from Iran, where he died in hospital two days ago after a 28-month battle with lung cancer.
Nouri al-Maliki, Iraq's Shia prime minister, and Jalal Talabani, an ethnic Kurd and Iraq's president, were among senior figures who attended the ceremony.
"We have lost you while we are undergoing a delicate and sensitive period, and in a time when we are in need of strong men with experience and who have made great sacrifices," al-Maliki said.
The airport ceremony replaced earlier plans to have an official service in Baghdad's heavily fortified Green Zone, the seat of the Iraqi government and the US embassy.
Iraqi security forces sealed off portions of Baghdad, closing major roads that linked the airport to the zone.
State television broadcast the service, which also was carried live on a number of other Arabic stations.
Al-Hakim, a former chain-smoker, died in Tehran on Wednesday.
He had been in Iran for treatment for more than four months and had also visited the United States in the past to consult lung cancer specialists.
Although he was seen as the Iraqi politician with the closest ties to Iran, he also managed to build a rapport with the US, even meeting George Bush, then the US president, at the White House in 2006.
Saad Jawad Qindeel, an Iraqi MP and former head of the ISCI political affairs unit, said it would be hard for anyone to follow al-Hakim and maintain the delicate position of being friendly with Iran and at the same time with the US.
"There will be a gap, and no one will be in a position to fill this gap. But there will be many contenders who [will] try to fill this," he told Al Jazeera.
Al-Hakim's son, Ammar, who led mourners on Friday, is seen as being likely to take over as leader of the ISCI, but he could face internal challenges.
The ISCI, in partnership with al-Maliki's Dawa party, swept to power in 2005 as part of a broad Shia coalition, but over the past year the alliance has struggled.
Al-Hakim's death has sparked fears of political instability ahead of national polls that many fear may be marred by violence.
|Al-Hakim's coffin was carried by an honour guard upon its arrival in Baghdad [Reuters]
Al-Maliki confirmed on Monday that he was breaking ranks with the ISCI to run independently in national polls set for January, raising questions about a split among Iraq's Shia majority.
The party was founded in Iran in 1982, while Iraq was under the rule of Saddam Hussein, then the Iraqi president.
The ISCI derives much support from the al-Hakim family name, revered among Iraq's Shia for its lineage of scholars and sacrifice in the face of assaults by Saddam and other violence.
Al-Hakim took over the leadership of the party in 2003 after Ayatollah Mohammed Baqr al-Hakim, his elder brother, was assassinated in a car bombing in Najaf in 2003.