8 When the Philistines heard that David had been anointed king over all Israel, all the Philistines went up in search of David; and David heard of it and went out against them. 9 Now the Philistines had come and made a raid in the valley of Rephaim. 10 David inquired of God, saying, “Shall I go up against the Philistines? And will You give them into my hand?” Then the Lord said to him, “Go up, for I will give them into your hand.”
11 So they came up to Baal-perazim, and David defeated them there; and David said, “God has broken through my enemies by my hand, like the breakthrough of waters.” Therefore they named that place Baal-perazim. 12 They abandoned their gods there; so David gave the order and they were burned with fire.
13 The Philistines made yet another raid in the valley. 14 David inquired again of God, and God said to him, “You shall not go up after them; circle around behind them and come at them in front of the balsam trees. 15 It shall be when you hear the sound of marching in the tops of the balsam trees, then you shall go out to battle, for God will have gone out before you to strike the army of the Philistines.” 16 David did just as God had commanded him, and they struck down the army of the Philistines from Gibeon even as far as Gezer. 17 Then the fame of David went out into all the lands; and the Lord brought the fear of him on all the nations.