Mastema is the name of an arch-demon who first appears in the literature of Israel's Second Temple Period and has gradually become an apocalyptic name for Satan.
The word mastemah meaning hatred, hostility, enmity or persecution in Hebrew is probable derived from Mastim, the Hiphil participle of Satam, which means 'the Adversary.' The term is sometimes used in the plural, which indicates that there was a class of 'the Mastema' as well as one prince, Mastema. This is similar to the chief Satan and his class of Satans (see 1 Enoch 40:7).
According to the book of Jubilees, Mastema Hostility is the chief of the demons engendered by the fallen Watchers/Angels with women, perhaps one of those same demons.
His actions and name indicate he is Satan, the 'Adversary', but much more the Satan who appears in the book of Job with a function to fulfill under God than the Satan of later tradition who is the uttermost enemy of God. Beliar, mentioned twice in Jubilees, is likely to be identical with Mastema in this work.
When God is ready to destroy all these demons after the flood and Noah prays that his descendants be released from their attacks, Mastema intervenes, beseeching God to allow him to retain and control one tenth of these demons in order to exercise his authority because they are "intended to corrupt and lead astray before my judgement because the evil of the sons of men is great". So Mastema is the tester of humans with God's permission.
When Mastema, the leader of the spirits, came, he said: 'Lord creator, leave some of them before me; let them listen to me and do everything that I tell them, because if none of them is left for me I shall not be able to exercise the authority of my will among mankind. For they are meant for (the purposes of) destroying and misleading before my punishment because the evil of mankind is great.' Then he said that a tenth of them should be left before him, while he would make nine parts descend to the place of judgment.- Jubilees 10:8-9
And they made for themselves molten images, and they worshipped each the idol, the molten image which they had made for themselves, and they began to make graven images and unclean simulacra, and malignant spirits assisted and seduced (them) into committing transgression and uncleanness. And the prince Mastema exerted himself to do all this, and he sent forth other spirits, those which were put under his hand, to do all manner of wrong and sin, and all manner of transgression, to corrupt and destroy and to shed blood upon the earth. For this reason he called the name of Seroh, Serug, for every one turned to do all manner of sin and transgression. - Jubilees 11:4-6
Mastema sends a plague of birds onto the land in the days of Terah.
Later, Mastema counsels God to test Abraham (Jubilees 17:15-16) just as Satan in the book of Job wants permission to test Job. As Abraham prepares to sacrifice his son Isaac, Mastema stands in God's presence. On his deathbed Isaac promises that the spirits of Mastema will have no power to turn Jacob or his descendants away from Yahweh.
Then Prince Mastema came and said before God: 'Abraham does indeed love his son Isaac and finds him more pleasing than anyone else. Tell him to offer him as a sacrifice on an altar. Than you will see whether he performs this order and will know whether he is faithful in everything through which you test him.' - Jubilees 17:16
The strange account in Exodus 4.24 where Yahweh meets Moses by the way and tries to kill him is retold in a way that attributes the attack to Mastema instead (Jubilees 48:1-3). It is claimed that Mastema aided the Egyptian priests that opposed Moses. Mastema is also said to have been chained while the Israelites left Egypt but then let go to encourage the Egyptians to chase after the Israelites and so come to their doom in the Red Sea.
You know who spoke to you at Mt. Sinai and what the prince of Mastema wanted to do to you while you were returning to Egypt - on the way at the shady fir tree. Did he not wish with all his strength to kill you and to save the Egyptians from your power because he saw that you were sent to carry out punishment and revenge on the Egyptians? - Jubilees 48:2-3
Mastema is also attributed with opposing Moses in Egypt. He is said to have helped the Egyptian sorcerers achieve their wonders and urged the Egyptians to pursue after the children of Israel. Mastema was even bound and imprisoned so that he might not accuse them, re-released so that he might help the Egyptians, and finally bound again.
And the prince Mastema stood up against thee, and sought to cast thee into the hands of Pharaoh, and he helped the Egyptian sorcerers, and they stood up and wrought before thee the evils indeed we permitted them to work, but the remedies we did not allow to be wrought by their hands.- Jubilees 48:9-10
And notwithstanding all (these) signs and wonders the prince Mastema was not put to shame because he took courage and cried to the Egyptians to pursue after thee with all the powers of the Egyptians, with their chariots, and with their horses, and with all the hosts of the peoples of Egypt. - Jubilees 48:12
Mastema is also attributed the slaying of the first-born in Egypt, which is attributed to the Lord in Exodus 12:29.
For on this night -the beginning of the festival and the beginning of the joy- ye were eating the passover in Egypt, when all the powers of Mastema had been let loose to slay all the first-born in the land of Egypt, from the first-born of Pharaoh to the first-born of the captive maid-servant in the mill, and to the cattle. - Jubilees 49:2