1. Preheat your oven to 350°F (175°C).
2. Cook the spaghetti according to the package instructions. Drain and set aside.
3. In a pan, heat the olive oil over medium heat. Add the chopped onion and garlic, and sauté until softened.
4. Add the ground beef to the pan and cook until browned. Season with salt and pepper.
5. Stir in the marinara sauce and let it simmer for a few minutes.
6. In a baking dish, layer the cooked spaghetti, meat sauce, and shredded mozzarella cheese.
7. Sprinkle the grated Parmesan cheese on top.
8. Bake in the preheated oven for 20-25 minutes, or until the cheese is melted and bubbly.
9. Let it cool for a few minutes before serving. Enjoy!