Preheat your oven to 375°F (190°C).
Cook the spaghetti according to package instructions until al dente. Drain and set aside.
In a skillet, heat olive oil over medium heat. Add minced garlic and cook until fragrant, about 1 minute.
Add ground beef or Italian sausage to the skillet and cook until browned and cooked through. Drain excess fat if necessary.
Stir in marinara sauce and dried oregano. Let simmer for 5 minutes.
In a mixing bowl, combine cooked spaghetti with ricotta cheese, half of the mozzarella cheese, and half of the Parmesan cheese. Season with salt and pepper to taste.
Spread half of the spaghetti mixture evenly into the bottom of a greased baking dish.
Top with half of the meat sauce mixture. Repeat layers with remaining spaghetti mixture and meat sauce.
Sprinkle the remaining mozzarella and Parmesan cheeses over the top.
Cover the baking dish with foil and bake in the preheated oven for 20 minutes. Then, remove the foil and bake for an additional 10 minutes or until the cheese is bubbly and golden.
Let cool for a few minutes before serving. Garnish with fresh basil leaves if desired.