I believe the Psalmist is describing a time when the enemy was trying desparately to defeat him in verse 5 of Psalms 23. He is declaring to us that we are not victims of the enemy. We are not to run from the enemy but through the power of God the enemy must be made to run from us.
II Corinthians 2:14 says, “Now thanks be unto God, which always causeth us to triumph in Christ, …”. The word triumph here means to celebrate the victory. So in a close walk with the Good Shepherd, there are many celebrations of His victory over Satan, the devil.
When we are in a trial or temptation, we need to face it squarely. Acknowledge that it is there and then take your stand against it in the name of Jesus. The man who faces the temptaton of lust for example, recognize it for what it is. Declare, “This is wrong. I will not do it.” Or in many cases, “I will not look at this pronography, because this is evil and I will not defile myself with the devil’s offering.” Then replace it with the precious Word of God. The Spirit of God can give you an instant replacement if you are looking for it. So while a very disappointed devil is still looking on, he sees you eating the precious Word of God instead of his defiling offerings. “Thou preparest a table before me in the presence of mine enemies” has now become a reality! Now this causes joy in your heart and you celebrate the victory at the table of the Good Shepherd.