According to John 1:1, Jesus, as the "word," was with God in the beginning and was God. It is the clear teaching of Scripture that Jesus was aware of His divinity. He articulated this understanding on multiple occasions (see Did Jesus claim to be God?). At the age of 12 Jesus affirmed His mission, knowing that He was about His Father's business (Luke 2:41-5). He called Himself the "I Am" in John 8:58 in connection with God as the "I Am" in Exodus 3:14.
When did Jesus know He was God?
Humanly speaking, much is left unknown regarding how Jesus' human understanding intersected with being God in human form. From birth, those who saw Him realized He is a king (Luke 2:1-20). Simeon and Anna recognized Him as the one God sent (Luke 2:22-38). At the age of 12, the religious teachers were amazed at His wisdom (Luke 2:41-50).
When Jesus began His public ministry at about the age of 30, John the Baptist recognized Him as the Coming Messiah. He said, "Behold, the Lamb of God, who takes away the sin of the world!" (John 1:29). A Roman centurion who witnessed Jesus' crucifixion declared Jesus' divinity (Matthew 27:54). The apostle John noted, "I have seen and have borne witness that this is the Son of God" (John 1:34).
Jesus both taught He is divine and gave evidence by His healings and miracles. His ultimate proof came through His resurrection from the dead on the third day, after which He appeared to many witnesses (1 Corinthians 15). When Thomas saw the resurrected Jesus, He made the clear and accurate statement, "My Lord and my God!" (John 20:28).
Some have suggested that in His human life, Jesus did not always know He is God. Philippians 2:7 talks about Jesus emptying Himself. Some say that Jesus set aside certain of His divine attributes while on earth. This does not contradict the fact that Jesus has always been and will always be fully divine. It simply means that Jesus chose to be limited in some respects (for instance requiring nourishment and sleep). Others argue that because Jesus did not lose His divine attributes or become any less divine while on earth, He was all-knowing during his earthly life. That He may not have expressed this knowledge in His early years does not detract from Jesus knowing He is God. Colossians 2:9 teaches, "For in him the whole fullness of deity dwells bodily." This is why others say there was never a moment that Jesus became less than one hundred percent omniscient (all-knowing) as a human.
Jesus was born of a woman and grew similarly to other humans. Yet He also held full deity within His human form, including full knowledge that He is divine. Though Jesus did not express this understanding until later, it is likely that Jesus always knew of His divine nature.
Did Jesus ever claim to be God? Is the deity of Christ biblical?
Is belief in the pre-existence of Jesus biblical?
How is Jesus the first-born over Creation? What does it mean for Jesus to be the first-born?
What is the theological concept of the hypostatic union?
What did Jesus mean when He said "I AM"?
Truth about Jesus Christ