Heat oven to 400° F. Place the squash on a rimmed baking sheet, drizzle the cut sides with the oil, place cut-side down, and roast until tender, 40 to 50 minutes.
Meanwhile, in a large bowl, combine the ricotta, egg, spinach, garlic, nutmeg, 1 teaspoon salt, and ⅛ teaspoon pepper.
With a fork, gently scrape out the strands of flesh and add to the ricotta mixture. Mix gently to combine.
Transfer the mixture to an 8-inch square baking dish, sprinkle with the mozzarella, and bake until browned and bubbling, 18 to 22 minutes.