Heat the oil in a large skillet over medium heat. Add the shallots and cook until soft and caramelized, about 5 minutes. Stir in the garlic, red pepper flakes and pinch salt/pepper.
Add in the spinach and cook until wilted.
Meanwhile, add the pasta to the salted water and cook a little more than half of the recommended time. For instance, if al dente is 10 minutes, cook for 6.
Add the slightly uncooked pasta to the skillet along with 2 ladles of pasta water. The pasta water has starches to help the sauce cling to the pasta, so don’t substitute regular water. Bring to a simmer and cook, stirring often, until the water has evaporated. Continue to add more pasta water, one ladle at a time (might only need 1-2 more) until pasta is al dente/cooked through.
Stir in the parmesan cheese and season to taste, if needed.