The militants tried to attack a residential compound of the paramilitary troops when they were confronted at the entry point
Four Pakistani paramilitary soldiers were killed and two injured in a clash with militants in the south western province of Balochistan on Monday, the military said.
The incident happened in Loralai district, around 262km northeast of the provincial capital Quetta.
According to a statement issued by the military, the militants tried to attack a residential compound of the paramilitary troops when they were confronted at the entry point.
The exchange of fire led to the deaths of four soldiers and four attackers including a suicide bomber.
No group has claimed responsibility for the attack, but Baloch separatist groups and Islamist militants have attacked security forces in the province in the past.
Earlier in December, a Pakistani separatist wanted over an attack on the Chinese consulate in Karachi in November was killed in a suicide blast in Afghanistan.
The Baloch Liberation Army (BLA) claimed that assault, labelling Beijing an "oppressor" and "making it clear that China's military expansionism on Baloch soil will not be tolerated."
It had warned the Chinese to leave or "be prepared for continued attacks."
The BLA is just one of the militant outfits operating in Balochistan, Pakistan's largest and poorest province, which borders Afghanistan and Iran and is rife with ethnic, sectarian and separatist insurgencies.
Its residents have long complained that it does not receive a fair share of the profits made from its mineral wealth.
The Pakistani military has been targeting insurgencies in the province since 2004, and has been repeatedly accused by international rights groups of abuses there.
China, one of Pakistan's closest allies, has poured billions into the South Asian country in recent years as part of the China-Pakistan Economic Corridor (CPEC), a massive infrastructure project that seeks to connect its western province of Xinjiang with the Arabian Sea port of Gwadar in Balochistan.
Pakistan sees the project as a "game changer," but it presents an enormous challenge in a country plagued by weak institutions, endemic corruption and a range of insurgencies in areas slated to host the corridor.
The subject of economic dividends from CPEC is extremely sensitive in some of those areas - particularly in Balochistan.
Since the beginning of the project militants have repeatedly attacked construction sites, blowing up numerous gas pipelines and trains, and targeted Chinese workers.