After the miraculous feeding of 5,000 men and their families (Matthew 14:16-21, Mark 6:35-44, Luke 9:12-17, John 6:5-14), Jesus told his disciples to get into a boat and go to the other side of the Sea of Galilee. He then dismissed the crowd and went up a mountain by himself to pray. Afterwards, Jesus performed a miracle of walking on water.
As explained in the Gospel of Matthew, which gives the most detailed account of the miracle in comparison to the Gospels of Mark and John:
Shortly before dawn Jesus went out to them, walking on the lake. When the disciples saw him walking on the lake, they were terrified. "It's a ghost," they said, and cried out in fear.
But Jesus immediately said to them: "Take courage! It is I. Don't be afraid."
"Lord, if it's you," Peter replied, "tell me to come to you on the water."
"Come," he said.
Then Peter got down out of the boat, walked on the water and came toward Jesus. But when he saw the wind, he was afraid and, beginning to sink, cried out, "Lord, save me!"
Immediately Jesus reached out his hand and caught him. "You of little faith," he said, "why did you doubt?"
And when they climbed into the boat, the wind died down. Then those who were in the boat worshiped him, saying, "Truly you are the Son of God."
- Matthew 14:22-33, NIV translation.
Read more in the book Jesus the Miracle Worker: The 50 miracles of Jesus explained in chronological order (The Jesus Series) -- now available at amazon.