Heat the oven to 400 °F. Add the cherry tomatoes and smashed garlic to a 9-by-13-inch baking dish, drizzle with 3 tablespoons of the olive oil, sprinkle with the red pepper flakes, and toss to coat. Nestle the feta block in the center and drizzle with the remaining 1 tablespoon olive oil.
Bake until the tomatoes burst and the feta is soft with golden edges, 30 to 35 minutes.
Meanwhile, bring a large pot of water to a boil and add the salt. Cook the pasta until al dente, 10 to 12 minutes, or 1 minute less than the package directions. Reserve 1 cup pasta water, then drain.
Remove the dish from the oven and mash the feta and tomatoes together with a fork until a creamy sauce forms.
Add the spinach a few handfuls at a time and stir until it wilts in the hot sauce.
Add the drained pasta and 1/2 cup of the reserved pasta water and toss until coated, adding more water a splash at a time as needed. Taste and season with salt.
Tear the basil over the top and serve right away.