1 Chronicles 14:8-17 - David Defeats The Philistines
8 And when it was known among the Philistines that David was anointed king upon all Israel, all the Philistines went up to seek David. And David heard of it and went out against them. 9 And the Philistines came and pranced in the valley of Rephaim. 10 And David asked God, saying, "Shall I go against the Philistines and wilt thou deliver them into mine hands?" And the LORD said to him: "Go, for I will deliver them into thine hand."
11 And when they were come as far as Baalperazim, David beat them there. And David said, "God hath divided mine enemies with mine hand as a man would divide water." And therefore they called the name of the said place Baalperazim. 12 And they left their gods there, which David bade to be burnt with fire.
13 And the Philistines came again and ran abroad in the valley. 14 Then David asked God, And God said to him, "Go not after them, but turn away from them, and come upon them straight from the pear trees. 15 And when thou hearest a sound go in the tops of the pear trees, then go out to battle: for God will go out before thee to smite the host of the Philistines." 16 And David did as God commanded him. And they smote the host of the Philistines all the way from Gibeon to Gezer. 17 And the fame of David went out into all lands, and the LORD made all nations fear him.