Taliban militants have attacked a Pakistani army post near the Afghan border killing at least eight soldiers, security officials say.

Dozens of heavily-armed militants overran the post north of the town of Wana in South Waziristan tribal agency, one official told AFP news agency. Ten militants were also said to have died.

Another four soldiers are reported killed in Bajaur agency to the north.

The deaths come despite recent army offensives in Pakistan's tribal areas.

Details of exactly what happened in the attack late on Tuesday in the Tiarza area of South Waziristan are hard to confirm.

Officials said the exchange of fire between militants and security forces continued for three hours. A Taliban spokesman said 12 soldiers had been killed, some of them beheaded.

A Pakistani army offensive cleared militants from South Waziristan in 2009, but there have been sporadic incidents in recent months.

In June, militants ambushed an army convoy in the Ladha area, killing an army officer and injuring about 10 soldiers.

There is no way of independently verifying any of the reports as the media are denied access to the tribal region.