Boil a large pot of salted water and cook spaghetti according to package instructions until al dente.
Heat olive oil in a pan over medium heat.
Add minced garlic to the pan and sauté until fragrant, about 1-2 minutes.
Stir in red pepper flakes if using.
Reserve 1/2 cup of pasta water, then drain the spaghetti.
Add the drained spaghetti to the pan with garlic oil.
Mix thoroughly to coat the pasta in the garlic oil.
Add reserved pasta water if the pasta seems dry.
Season with salt and toss in chopped parsley.
Serve hot, topped with grated Parmesan cheese.