Cook the spaghetti in salted boiling water according to package instructions. Drain and set aside.
Heat the vegetable oil in a large pan over medium heat.
Add the chopped onion and cook until soft, then add the garlic and cook for 30 seconds.
Add the ground beef and cook until browned, breaking it apart as it cooks. Drain excess fat if needed.
Stir in the tomato paste, tomato sauce, oregano, basil, salt, and black pepper.
Let the sauce simmer for 10–15 minutes, stirring occasionally.
Add the cooked spaghetti to the sauce and toss until well coated.
Serve hot.