Tribesmen fought street battles with automatic weapons from late Monday until early Tuesday near the town of Bara, in Khyber district, tribal areas spokesman Shah Zaman said.
The fighting was sparked by a row over the demolition of a house, between the groups led by Pakistani cleric Mufti Munir Shakir and rival Afghan religious leader Pir Saifur Rehman, the spokesman said.
Five of Shakir's men were shot dead on Monday when they tried to knock down the dwelling belonging to the Afghan cleric's faction, he added.
The Pakistani tribesmen had also taken an unknown number of people hostage, an intelligence official said.
In retaliation, the Pakistani mullah's clan attacked Rehman's men at around 2am (2100 GMT) on Tuesday, killing 18 of them, the official said.
The situation was tense in the area and the local administration was trying to end fighting through a jirga, or tribal assembly, he said.
Both clerics are supporters of Afghanistan's former Taliban government, many members of which fled across the border to Pakistan's tribal areas after the movement was ousted by a US-led invasion in late 2001.
Officials said Shakir and Rehman have both set up illegal radio stations broadcasting religious material throughout the tribal areas.
Tensions are already high in the border region following serious clashes earlier this month between troops and pro-Taliban insurgents in the North Waziristan tribal area, which have left more than 200 fighters dead.