Heat the butter, sauté the onion until translucent, add the flour, sweat until it loosens from the bottom of the pan, deglaze with milk while stirring constantly. Season with salt, pepper, nutmeg and chopped garlic.
Grease a large baking dish and spread the spinach in it, place the matjes pieces on top and pour half of the sauce over it. Layer the potato slices and cover with the remaining sauce. Sprinkle with the cheese and cook in a preheated oven at 200 ° C for 50 - 60 minutes.