Boil water in a large pot, add a pinch of salt, and cook the pasta according to package instructions until al dente. Reserve about 1/2 cup of pasta water, then drain the pasta and set aside.
In a large skillet, heat the olive oil over medium heat. Add the diced onion and cook until translucent, about 3-4 minutes.
Stir in the minced garlic and sauté for another 30 seconds until fragrant.
Add the chopped spinach to the skillet. Cook for about 3-4 minutes, stirring frequently until the spinach has wilted down.
Lower the heat and add the ricotta cheese and heavy cream to the skillet. Mix until well combined and heated through, about 2 minutes.
Season with salt, black pepper, and optional red pepper flakes if using.
Add the drained pasta to the skillet, tossing to combine everything together. If the mixture seems dry, add a splash of the reserved pasta water until desired consistency is reached.
Serve hot, garnished with grated Parmesan cheese.