Bring a large pot of salted water to a boil. Add the spaghetti and cook until al dente according to package instructions.
In a bowl, combine the ricotta, olive oil, Parmesan, garlic, lemon zest and juice, salt, pepper, and red pepper flakes if using.
Return the drained pasta to a large pan over low heat and add the baby spinach.