See also Matthew 14:22-33 and Mark 6:45-52.
Jesus had just fed five thousand men, plus women and children. This was a huge crowd of people, and it had been a long day. As evening approached, Jesus made his disciples get into the boat without him, and he sent them to the other side of the Sea of Galilee. He probably knew that the situation with the crowd was going to become tricky so he sent his disciples out of harm’s way, while he stayed behind to dismiss the crowd.
The crowd, having just witnessed the amazing miracle of Jesus feeding five thousand, realised that Jesus was “The Prophet”, the Messiah (Deut. 18:15, 18), and they wanted to seize him and make him king by force. To avoid a pointless confrontation, Jesus withdrew (again) to a mountain, and there, alone, he spent a few hours in prayer with his Father.
When the disciples’ boat was in the middle of the lake, about 5 km from shore, a strong wind came up. The disciples struggled for hours trying to row with the wind against them. After about 9 hours of difficult rowing they had covered a distance of only about 4 km. They were now a relatively short distance from shore but were still in trouble. They were exhausted and battling against the driving wind and the choppy waves.
Jesus had been watching all this from land and began walking towards them on the sea. As Jesus neared the boat, the disciples thought they were seeing a ghost and they were terrified. Jesus tells them that it is him, to take courage and not to be afraid. [Jesus uses the term “egō eimi” (I am) in this sentence.] In Matthew’s narrative of this event we read that Peter joins Jesus on the water.
The disciples took Jesus into the boat and immediately the wind died down and they arrived on dry land. The disciples’ ordeal miraculously came to an abrupt end. Relieved and astonished, “those who were in the boat worshipped him saying, “Truly you are the Son of God!” (Matt. 14:33)
Jesus is always watching us too and is nearer than we sometimes think. He wants us to have faith in him. He wants us to take courage and not be afraid. He is with us in our ordeals and struggles, and he will see us through.
 Some theologians believe that Jesus was just walking along the seashore (as in John 21:1), however, all three gospel writers are careful to make the distinction between the sea and the land in their narratives.
 Mark seems to indicate that Jesus intention was merely to cross the sea to get to the other side; not necessarily to meet the disciples and get into the boat (Mark 6:48b).