Fill a large pot with water.
Bring the water to a boil over high heat.
Add 1 teaspoon of salt to the boiling water.
Add the spaghetti to the pot.
Cook the spaghetti according to the package instructions until al dente.
Before draining, scoop out 1/2 cup of pasta water and set it aside.
Drain the spaghetti and set it aside.
Place a large skillet over medium heat.
Pour the olive oil into the skillet.
Add the sliced garlic to the hot oil.
Stir the garlic frequently for 2 to 3 minutes until golden and fragrant.
Reduce the heat to low to prevent burning.
Sprinkle the red pepper flakes, black pepper, and remaining salt into the skillet.
Stir to combine the seasonings with the garlic oil.
Add the drained spaghetti to the skillet.
Toss the spaghetti in the garlic oil until fully coated.
If the pasta looks dry, pour in a little reserved pasta water.
Stir well and add more water if needed for the right consistency.
Remove the skillet from the heat.
Sprinkle the Parmesan cheese over the pasta if using.
Toss everything together to combine.
Garnish with fresh parsley if desired.
Serve immediately while warm.