Boil a large pot of water and cook spaghetti according to the instructions on the package.
Meanwhile, heat a deep skillet over medium-high heat and saute onions and garlic until lightly brown and translucent, adding a drop of vegetable broth if sticking occurs.
Add tomatoes, broth and vinegar and simmer for about 8 minutes.
Stir in basil, red pepper flakes, and black pepper, then add cooked pasta and toss to coat.
Continue simmering for another 5 minutes, then serve.