There are only three other places in Scripture, that I can find, where an angel comes to a barren woman to announce that she will conceive a son: Sarah, that she will conceive Isaac, the son of the promise; Elizabeth, that she will conceive John the Baptist (actually the angel came to Zechariah and not Elizabeth); and Mary, that she will conceive Jesus (although Mary was not barren). That is very distinguished company that Samson’s mother finds herself in. Since Samson was born to begin to deliver Israel out of the hands of the Philistines (Jud 13:5), as deliverer he is a type of Messiah.
Samson is set apart to God from birth as a Nazirite. A Nazirite is someone who makes a vow to God, to be set apart to Him for a certain season, and during that season they do not cut their hair or drink wine; and at the end of the season, when they have completed their vow, they shave the hair of their head, and bring an offering, then they are released from their vow. The law concerning Nazirites is found in Num 6. “Nazir” in Hebrew means “separate, consecrate.” The purpose of the vow is to draw near to God’s presence by a ritual of set apartness.
So God declared Samson to be set apart to Him from birth, and the mark of Samson’s set apartness is his unshorn hair. His great strength is a supernatural gift to him from the Holy Spirit, as long as he remains a Nazirite, or as long as he remains set apart.
Samson has a character flaw, however: he is impulsive. He wanted what he wanted, when he wanted it, and he did not think it through. The Scripture says the matter with the Philistine woman was from God, in order to find an occassion of war with them, so that Israel can be freed from the Philistine yoke (Jud 14:4). But God in His great wisdom, took Samson’s impulsiveness, his weakness, into account, and worked through him, weaknesses and all, to accomplish His purpose. He uses imperfect people – they can be set apart to God also, be used of Him also, and receive supernatural gifts of the Spirit also!