Did John not recognize Jesus until the Spirit came down and remained on Him? Did this not occur over a month before Jesus' temptation? Then why wasn't John able to recognize him in the crowd when the Sadducees and Pharisees came to trap him? Why did John not recognize Jesus until the next day?
Jesus was baptized by John the Baptist and tempted in the wilderness before John the Baptist revealed that he did not know who was the Messiah. The events in John 1:24-28 occurred after Jesus was baptized and tempted in the wilderness. This passage tells us that some Pharisees had asked John if He was the Christ, Elijah, or the Prophet. John told them that he was not the Christ, Elijah, or the Prophet. The next day, John saw Him coming toward him and announced to everyone that He was the Lamb of God who takes away the sin of the world, and eventually made the following statement,
John testified saying, “I have seen the Spirit descending as a dove out of heaven, and He remained upon Him. I did not recognize Him, but He who sent me to baptize in water said to me, ‘He upon whom you see the Spirit descending and remaining upon Him, this is the One who baptizes in the Holy Spirit.’ I myself have seen, and have testified that this is the Son of God.” (NASB) John 1:32-34
Why did John the Baptist not recognize Jesus earlier? John the Baptist must have known about Jesus, since Jesus lived in Galilee and was a relative. Most likely John had heard reports about Jesus even though they lived hundreds of miles apart. Jesus’ encounter with the teachers in the temple court in Jerusalem was most likely well known throughout the priesthood. John’s father was a priest. Yet, he had doubts about Jesus as some would have had and some do even today. John had apparently asked God for a sign. That is implied by the passage above. John had asked God to reveal the Messiah to Him in a unique way. So God granted John a sign. The sign was the Holy Spirit descending upon the Messiah. At the time of Jesus’ baptism, John revealed that he knew Jesus was a holy man (Matt. 3:15); but he did not know He was the Messiah. But when the sign occurred and the Holy Spirit descended upon Jesus during His baptism, John knew Jesus was the Messiah. When John saw this, he must have been a very excited man.
Later when John was in prison, his doubts came back. John sent his disciples to Jesus and asked if He was the One. Jesus told his disciples to go back and tell John about the miracles that Jesus was performing. Today, God reveals miracles to us too! He does in different ways for different people so that we know He is there. May the Lord bless you.
Reference Links:Baptism of Jesus