The BBC reports the attack started in Karachi when four gunmen wielding automatic rifles drove up in a silver Toyota Corolla, lobbed a grenade, then started shooting at security personnel who tried to stop them from entering the building.
Four security guards and a police officer were shot dead in the attack.
The outlawed Balochistan Liberation Army (BLA) claimed responsibility through social media, but such an attack reflecting "frustration" of Indian agency RAW over peace in Pakistan's financial hub was not possible without the help of any foreign hostile agency, the chief of paramilitary Rangers later told media.
In May a year ago, the BLA attacked a luxury hotel near Gwadar, where a deepwater port development is a CPEC flagship project.
Editor's note: This article has been updated with new details throughout.
The same militant group previously mounted a deadly attack on the Chinese consulate in Karachi in November 2018 and in May a year ago attacked a hotel in Gwadar, a port city in Balochistan used by Chinese working on China-Pakistan Economic Corridor projects. Some believe that it could be one reason for the group, designated as a terrorist organization by Pakistan, the United States, Britain and the European Union, attacking the bourse. The Pakistani government expected that such an attack could be perpetrated. "We shall protect Sindh at all costs", he said.
The gunmen never made it into the stock exchange and business continued as usual after the attack. "PSX benchmark index one of the best performers in Asia today so far", tweeted Mr Mohammed Sohail, a broker at the exchange.
Rizwan Ahmed, a police official at the scene, said that after the attack was over, food supplies were found on the bodies of the gunmen, indicating they may have planned a long siege, which the police quickly thwarted.
Karachi was once a hotspot for crime and political and ethnic violence, with heavily armed groups tied to politicians frequently gunning down opponents and launching attacks on residential areas.
Three of the attackers were later identified as Salman, Tasleem Baloch and Siraj through their fingerprints, an officer of the Counter-Terrorism Department (CTD) of Sindh Police Raja Umer Khattab said, adding that they belonged to Ketch area of Balochistan.