Preheat your oven to 350°F (175°C).
Cook spaghetti according to package instructions until al dente.
In a skillet, brown the ground meat over medium heat; drain excess fat.
Stir in marinara sauce and let simmer for 5 minutes.
In a bowl, mix ricotta cheese, egg, salt, and pepper until smooth.
Combine cooked spaghetti with the meat sauce in a large bowl.
In a greased baking dish, layer half of the spaghetti mixture.
Spread the ricotta mixture over the spaghetti.
Add the remaining spaghetti on top and sprinkle with mozzarella and Parmesan cheese.
Bake for 25-30 minutes or until the cheese is bubbly and golden.