The clash erupted when security personnel were conducting a search operation in Kharotabad area of Quetta, the capital of Balochistan province, this morning.
Sixteen security personnel, including an officer, were injured when the militants lobbed grenades and opened fire.
Police officials said the militants blew themselves up to avoid capture.
TV news channels reported the explosion killed members of the militants' families, including women and children, though this could not be independently confirmed.
Personnel from the Frontier Corps, Anti-Terrorist Force, Balochistan Police and intelligence agencies participated in the search operation that began at 5 am.
Deputy Inspector General of Police (Operations) Fayyaz Sumbal told reporters that law enforcement agencies conducted the search operation after receiving information about the presence of suspected terrorists in Kharotabad.
The dead and injured were taken to a nearby hospital and the injured security personnel were out of danger, he said.