In Exodus when God performed miracles through Moses and Aaron, the Egyptian magicians did the same things that God did, How is that possible ?
The first time:
So Moses and Aaron went to Pharaoh and did just as the Lord commanded. Aaron threw his staff down in front of Pharaoh and his officials, and it became a snake. Pharaoh then summoned wise men and sorcerers, and the Egyptian magicians also did the same things by their secret arts: Each one threw down his staff and it became a snake. But Aaron’s staff swallowed up their staffs. Yet Pharaoh's heart became hard and he would not listen to them, just as the Lord had said.
The second time:
Moses and Aaron did just as the Lord had commanded. He raised his staff in the presence of Pharaoh and his officials and struck the water of the Nile, and all the water was changed into blood. The fish in the Nile died, and the river smelled so bad that the Egyptians could not drink its water. Blood was everywhere in Egypt.
But the Egyptian magicians did the same things by their secret arts, and Pharaoh's heart became hard; he would not listen to Moses and Aaron, just as the Lord had said. Instead, he turned and went into his palace, and did not take even this to heart. And all the Egyptians dug along the Nile to get drinking water, because they could not drink the water of the river.
The third time:
Then the Lord said to Moses, "Tell Aaron, 'Stretch out your hand with your staff over the streams and canals and ponds, and make frogs come up on the land of Egypt.'"
So Aaron stretched out his hand over the waters of Egypt, and the frogs came up and covered the land. But the magicians did the same things by their secret arts; they also made frogs come up on the land of Egypt.
But lastly they couldn't do like Moses:
Then the Lord said to Moses, "Tell Aaron, 'Stretch out your staff and strike the dust of the ground,' and throughout the land of Egypt the dust will become gnats." They did this, and when Aaron stretched out his hand with the staff and struck the dust of the ground, gnats came on people and animals. All the dust throughout the land of Egypt became gnats. But when the magicians tried to produce gnats by their secret arts, they could not.
Since the gnats were on people and animals everywhere, the magicians said to Pharaoh, "This is the finger of God." But Pharaoh's heart was hard and he would not listen, just as the Lord had said.