Preheat your oven to 350°F (175°C).
Cook spaghetti according to package instructions until al dente; drain and set aside.
In a large bowl, mix ricotta cheese, egg, garlic powder, Italian seasoning, salt, and pepper.
Fold in the cooked spaghetti and marinara sauce until well coated.
Spread half of the spaghetti mixture into a greased baking dish.
Sprinkle half of the mozzarella cheese over the first layer.
Add the remaining spaghetti mixture on top.
Top with the remaining mozzarella and all of the Parmesan cheese.
Cover with foil and bake for 20 minutes.
Remove foil and bake for an additional 10 minutes, until cheese is bubbly and golden.