In a large skillet, heat olive oil over medium heat. Add the chopped onion and sauté for 3-4 minutes until translucent. Stir in the minced garlic and cook for an additional 1 minute until fragrant. Remove from heat.
In a large mixing bowl, combine the cooked spaghetti, ricotta cheese, 1 cup of mozzarella cheese, Parmesan cheese, eggs, sautéed onions and garlic, Italian seasoning, salt, and pepper. Mix until well combined.
Grease a 9-inch pie dish or round baking dish with non-stick spray or olive oil. Pour the spaghetti mixture into the dish and spread it evenly.
Top the spaghetti pie with the remaining ½ cup of mozzarella cheese and a layer of marinara sauce.
Bake in the preheated oven for 25-30 minutes or until the cheese is bubbly and golden brown.
Remove from the oven and allow to cool for 5 minutes before slicing.
Garnish with fresh basil leaves before serving.
Notes
Allow to cool slightly before slicing for easier serving.