Add the minced garlic and cook for 30 seconds until fragrant. Stir in the red chili flakes and cook for another 30 seconds. Set aside 2 teaspoons of this mixture for garnish.
Cook the spaghetti in the boiling water, stirring occasionally. Drain it 1-2 minutes before the package's recommended time.
Combine the drained spaghetti with the sauce in the pan. Add 1/2 cup of pasta cooking water and lemon juice. Stir over medium heat until the sauce thickens and coats the spaghetti.
Serve with the reserved chili onion mixture, fresh parsley, and grated cheese if desired.