Bring a large pot of salted water to a boil and cook the spaghetti according to package directions until al dente; reserve 1 cup of the cooking water and drain the pasta.
While the pasta cooks, heat the olive oil in a large sauté pan over medium heat.
Add the minced garlic, red pepper flakes, and Italian herb seasoning to the pan and cook, stirring, until fragrant, about 1 to 2 minutes—do not let the garlic brown.
Add the baby spinach and toss until just wilted, about 2 to 3 minutes, then season with the salt and freshly ground black pepper.
Add the drained spaghetti to the pan and toss to combine, adding the reserved pasta cooking water 1/4 cup at a time as needed to loosen and create a light sauce.
Divide the pasta among plates and top generously with the grated Pecorino or Parmesan cheese, then serve immediately.