Preheat the oven to 350°F and lightly grease a 13" x 9" baking dish with cooking spray to prevent sticking.
Bring a large pot of salted water to a rolling boil. Add the spaghetti and cook until al dente, following the package instructions. Stir occasionally to prevent clumping. Once cooked, drain the pasta thoroughly and set it aside.
Meanwhile, heat olive oil in a large skillet over medium heat. Add the finely chopped onion and sauté until soft and translucent, about 7 minutes. Stir in the garlic and cook for an additional minute until fragrant. Add the ground beef and Italian seasoning, seasoning generously with salt and pepper. Break up the meat with a wooden spoon as it cooks, ensuring an even crumble. Continue cooking until the beef is browned and no longer pink, about 8 minutes.
Pour in the crushed tomatoes and tomato sauce, followed by the chopped fresh basil. Stir well to combine, then bring the sauce to a gentle simmer. Allow it to cook for approximately 10 minutes, stirring occasionally, until the mixture slightly reduces and thickens. Taste and adjust seasoning with additional salt and pepper if needed.
Add the drained spaghetti to the skillet and toss until every strand is well-coated in the sauce. Transfer the mixture to the prepared baking dish, spreading it evenly. Sprinkle shredded mozzarella over the top, followed by a generous dusting of Parmesan.
Bake for about 20 minutes, or until the cheese is melted and bubbling and the pasta is warmed through.
Remove from the oven and garnish with freshly chopped parsley. Serve hot and enjoy!