Heat a cast-iron skillet over medium heat for a few minutes until it is hot. Add the butter and swirl it around to evenly coat the surface.
Crack the egg into the skillet, being careful not to break the yolk. Cook the eggs on medium heat until the whites are set but the yolks are still runny, about 2-3 minutes.
Carefully remove the egg from the skillet with a metal spatula and place it on a plate. Season with salt and pepper, if desired.