Preheat the oven to 350 degrees F. Lightly butter a 9-by-13-inch baking dish.
Cook the spaghetti in a large pot of boiling salted water until al dente. Drain well and spread the spaghetti on a baking sheet; let cool.
In a large bowl, toss the fontina with the Gruyere and mozzarella. Spread half of the spaghetti in the prepared baking dish in an even layer. Sprinkle half of the mixed cheeses and half of the Gorgonzola over the spaghetti and season with salt and pepper. Repeat with another layer of spaghetti, mixed cheeses, Gorgonzola and salt and pepper.
Bake the spaghetti in the center of the oven until the top is golden brown, about 40 minutes. Let cool slightly before cutting into squares and serving.