TEHRAN, Young Journalists Club (YJC) - The militants had infiltrated from across the Afghan border, and an officer was among the Pakistani soldiers killed, according to a statement issued by the military.
Nine militants were also killed in the exchange of fire, it said.
Violence in Pakistan has declined in recent years following a series of military operations along the northwestern border with Afghanistan, but militant groups are still able to carry out deadly attacks.
Saturday's incident occurred in Spera Kunar Algad area of North Waziristan near the Afghan border.
There have been a number of fatal assaults in recent months in the northwest as well as in the southwestern Balochistan province.
Pakistan's army launched its operation in mid-2014 to wipe out militant bases in the area and end the near decade-long insurgency that has cost thousands of lives.
The operation was intensified after the Taliban massacred more than 150 people, the majority of them children, at a school in the northwestern city of Peshawar in December 2014.
In 2016, the Pakistani army claimed to have cleared the last militant stronghold in the country's northwest after a three-month long operation.