2Sam 5:17-25

Philistine Attack Repulsed 17When the Philistines heard that David had been anointed king over Israel, all the Philistines went up in search of David; but David heard about it and went down to the stronghold.18Now the Philistines had come and spread out in the valley of Rephaim.19David inquired of the Lord, “Shall I go up against the Philistines? Will you give them into my hand?” The Lord said to David, “Go up; for I will certainly give the Philistines into your hand.”20So David came to Baal-perazim, and David defeated them there. He said, “The Lord has burst forth against my enemies before me, like a bursting flood.” Therefore that place is called Baal-perazim.21The Philistines abandoned their idols there, and David and his men carried them away.22Once again the Philistines came up, and were spread out in the valley of Rephaim.23When David inquired of the Lord, he said, “You shall not go up; go around to their rear, and come upon them opposite the balsam trees.24When you hear the sound of marching in the tops of the balsam trees, then be on the alert; for then the Lord has gone out before you to strike down the army of the Philistines.”25David did just as the Lord had commanded him; and he struck down the Philistines from Geba all the way to Gezer.