1Bring a large pot of generously salted water to a boil over high heat. Add the spaghetti and cook until al dente or according to the package directions. Drain (without rinsing), reserving 1 cup of the cooking water.
2Return the pot to the stove over medium-low heat. Add the olive oil, garlic, and red pepper flakes (if using) and season with salt and pepper. Cook, stirring often, until the garlic is fragrant, about 30 seconds.
3Return the pasta to the pot, add half of the reserved pasta water, and stir to coat. Add the remaining pasta water, taste and season with salt and pepper if needed, and stir again. Remove the pot from heat. If you choose, serve the spaghetti topped with grated Parmesan cheese.