Beloved, do not believe every spirit, but test the spirits to see whether they are from God, for many false prophets have gone out into the world. By this you know the Spirit of God: every spirit that confesses that Jesus Christ has come in the flesh is from God, and every spirit that does not confess Jesus is not from God. This is the spirit of the antichrist, which you heard was coming and now is in the world already. Little children, you are from God and have overcome them, for he who is in you is greater than he who is in the world. They are from the world; therefore they speak from the world, and the world listens to them. We are from God. Whoever knows God listens to us; whoever is not from God does not listen to us. By this we know the Spirit of truth and the spirit of error.
Throughout the bible there seem to be passages like this that don't really add anything to what we've heard from previous passages, but rather it's the personal spin or recollection of an eyewitness to an event. Furthermore, this was not just a recount of an event, but a digest of Jesus's teachings. Specifically this is a digest of what Jesus said about John the Baptist and later what Jesus said about believers being like children. These events might best be recounted in the passages Matthew 13:7 and Matthew 18:13. So the author of 1 John 4 is drawing from these events, by just extracting the message.
So what does it all mean? It's talking about the proverbial "two types of people in the world", those that follow Jesus and those that follow the world. You can't serve two masters, so testing someones spirit will determine if they are just following the popular opinions of the world, one of which might happen to be Jesus and therefore can be deceptive. Openness and naive acceptance of our place within the world is the truest test of faith. Jockeying and manipulation to gain a more favorable position is what reveals the spirit of someone that belongs to the world. Humble acceptance is what reveals the spirit of someone that seeks truth.