Preheat oven to 350 degrees F (175 degrees C). Grease one 9x13-inch baking dish.
Bring a large pot of water to a boil and add spinach. Cover, reduce heat, and cook until heated through, 5 to 6 minutes. Drain well, squeezing out excess moisture with your hands. Set aside to cool.
Melt butter in a saucepan over medium heat; stir in onion and cook until soft and translucent, 5 to 10 minutes.
Transfer onions to a double boiler; mix in milk, Cheddar cheese, flour, and ground black pepper; cook and stir until blended and smooth, about 5 minutes. Remove from heat; fold in eggs and spinach. Pour the spinach mixture into baking dish and smooth top.
Bake, uncovered, in the preheated oven until a toothpick inserted in the center comes out clean, about 30 minutes. Cool briefly before cutting into squares.