1. Melt butter in a skillet over medium heat. Sauté onion 6 minutes. Stir in spinach; remove from heat. In a bowl, whisk remaining ingredients through nutmeg.
2. Rub a 9-by-13-inch baking dish with garlic; discard. Spread bread in dish; top with onion mixture and ham. Add milk mixture. Press into bread. Cover with foil; chill 2 hours or overnight.
3. Preheat oven to 350ºF. Bake, covered, until set, about 30 minutes. Uncover, scatter with rest of cheese; bake 10 minutes. Move rack to highest position; preheat broiler to high. Broil until golden, about 3 minutes. Serve.