Heat olive oil in a large pan over medium heat. Add onion and garlic, cook until softened.
Stir in the ground beef. Cook until browned, breaking up any lumps with a wooden spoon.
Add tomato paste, canned tomatoes, oregano, and basil. Stir well and season with salt and pepper.
Lower the heat and let the sauce simmer uncovered for 20–25 minutes, stirring occasionally.
Meanwhile, cook spaghetti in a large pot of salted boiling water according to package instructions until al dente.
Drain the pasta, then add it to the sauce. Toss gently until the spaghetti is well coated.
Serve hot, topped with Parmesan cheese and parsley if you like.