Bring a large pot of salted water to a rolling boil, then add the spaghetti and cook until al dente according to package directions.
While the pasta cooks, heat the olive oil in a large skillet over medium to medium-low heat.
Add the sliced garlic to the oil and stir constantly until the garlic is just golden and fragrant, taking care not to burn it.
Stir in the red pepper flakes, then remove the skillet from the heat.
When the pasta is done, reserve at least 1/2 cup of the pasta cooking water, then drain the pasta.
Transfer the drained pasta to the skillet with the garlic oil, add at least 1/2 cup of the reserved pasta water, and toss thoroughly to coat. Add more pasta water as needed to loosen the sauce.
If using, add the chopped parsley and grated Parmesan, tossing lightly to combine.
Serve immediately.