Two intelligence operatives, including a Deputy Director of the Inter-Services Intelligence agency, were among the dead, media reports quoted officials as saying.
A group of terrorists wearing suicide vests and carrying automatic weapons targeted a compound housing offices of the ISI, Military Intelligence and Pakistan Rangers at Sukkur, the third largest city of Sindh province, yesterday evening.
The attack started shortly after sunset, when militants rammed an explosive-rigged vehicle into the high-security compound in Barrage Colony, forcing a big opening through which terrorists stormed in.
They lobbed grenades at the ISI office and engaged police and paramilitary forces in a gun battle that lasted hours.
Shehzad Abro, an official in the district police control room, told PTI that five persons died in the suicide attack and gun battle before five attackers were killed.
An intelligence official said the five dead included two intelligence personnel, two policemen and a civilian employee. He said 40 people were injured.
Reports said two terrorists blew themselves at the start of the attack while three more were killed in the gun battle.
The residences of several senior government officials are also located in the compound, including one for Deputy Inspector General of Police Javed Odho, who told media that the ISI office was the target.
No group claimed responsibility for the brazen attack.
The spy agency has spearheaded the fight against the militants, who have targeted it several times in retaliation.
Dozens were killed in attacks on ISI offices in Multan, Faisalabad and Lahore in Punjab province in recent years.
The powerful army, which controls the ISI, has not commented on yesterday's attack, which came after reports that the intelligence agency's chief briefed Prime Minister Nawaz Sharif few weeks back about the danger posed by militants to national security.