Chapter 12, which dealt with aspects of obeying the first commandment, ended with a general command to avoid the pagan practices of the Canaanites (Deut. 12:29 – 31). Chapter 13 extends this discussion by presenting three situations that could arise to tempt someone to paganism. At the same time, it can be seen as a sermonic treatment of the second commandment – You shall not make for yourself an idol… (Deut. 5:8 – 10). It presents three situations where a person could be tempted to fall away from the worship of the true God and instead serve and worship other gods (apostasy).
In the Hebrew Bible, Deut. 12:32 is the first verse of chapter 13. But this commentary follows the verse numbering of the NASB, in which verse 32 is part of chapter 12.
Deuteronomy 13 can be outlined as follows:
Dealing with prophets encouraging apostasy (Deut. 13:1 – 5)
Dealing with relatives and friends encouraging apostasy (Deut. 13:1 – 5)
Dealing with a town encouraging apostasy (Deut. 13:1 – 5)

Deuteronomy 13:1-5

To enforce the second of the Ten Commandments, Moses commands the Israelites to execute any false prophet who may entice them to serve other gods, in order to purge the evil from among them.

Deuteronomy 13:6-11

Moses warns the people against listening to a close relative or a dear friend who may entice them secretly to serve other gods. He then commanded that the tempter must be put to death. This needed to be done to ensure that such a wicked act is not repeated among the Israelite community.

Deuteronomy 13:12-18

Moses commands the Israelites to destroy an entire city that has succumbed to the enticements of the false prophets and has fallen into idolatry.