Cook the spaghetti in salted boiling water until just about tender. Drain, reserving 1 cup of the cooking water.
Meanwhile, combine the oil and garlic in a large skillet over medium-low heat. Cook, stirring often, until the garlic becomes fragrant and is just beginning to turn golden, 4 to 6 minutes. Add the spinach. Season with salt and pepper and then cook, tossing gently with tongs, until the spinach begins to wilt, 2 to 3 minutes.
Add the drained pasta and 1/2 cup of the reserved cooking water. Cook for 1 to 2 minutes, tossing and stirring to combine and blend the flavors. If the pasta isn’t tender or seems dry, add the remainder of the cooking water and continue to cook and stir until done. Season to taste with salt and pepper. Sprinkle with cheese.