And when the Philistines heard that David was anointed king over all Israel, all the Philistines went up to seek David. And David heard of it, and went out against them. And the Philistines came and spread themselves in the valley of Rephaim. And David enquired of God, saying, “Shall I go up against the Philistines, and wilt Thou deliver them into mine hand?” And the LORD said unto him, “Go up; for I will deliver them into thine hand.”
So they came up to Baalperazim; and David smote them there. Then David said, “God hath broken in upon mine enemies by mine hand like the breaking forth of waters.” Therefore they called the name of that place Baalperazim. And when they had left their gods there, David gave a commandment, and they were burned with fire. And the Philistines yet again spread themselves abroad in the valley.
Therefore David enquired again of God; and God said unto him, “Go not up after them; turn away from them, and come upon them over against the mulberry trees. And it shall be, when thou shalt hear a sound of going in the tops of the mulberry trees, that then thou shalt go out to battle: for God is gone forth before thee to smite the host of the Philistines.”
David therefore did as God commanded him: and they smote the host of the Philistines from Gibeon even to Gazer. And the fame of David went out into all lands; and the LORD brought the fear of him upon all nations. 1 Chronicles 14:8-17
References: 1 Chronicles 14:1-7; 13; 15; 1 Samuel 30:8; Psalm 2:1-6; 115:2-8; 135:14-18; Proverbs 3:6; Revelation 11:15-18