Preheat your oven to 350°F (175°C).
Cook spaghetti according to package instructions until al dente.
In a large bowl, mix ricotta cheese, egg, Italian seasoning, salt, and pepper.
Drain the spaghetti and add it to the ricotta mixture, stirring to combine.
Spread half of the marinara sauce in a baking dish.
Layer half of the spaghetti mixture over the sauce.
Sprinkle half of the mozzarella cheese on top.
Repeat the layers with the remaining sauce, spaghetti, and cheese.
Top with grated Parmesan cheese.
Bake for 25-30 minutes until bubbly and golden brown.