Preheat oven to 400℉ with rack 6 inches from heat source.
Heat 1 tablespoon oil in a 10-inch cast-iron skillet over medium heat.
Add 1 (17.5-ounce) package gnocchi; cook, stirring often, until golden-brown, about 3 minutes.
Reduce heat to low. Add the remaining 1 tablespoon oil.
Stir in 5 cups spinach; cook, stirring often, until wilted, about 3 minutes.
Stir in 3 cups marinara and ½ teaspoon crushed red pepper; cook, stirring occasionally, until bubbling, about 2 minutes.
Remove from heat; sprinkle with ¾ cup mozzarella and dollop with ½ cup ricotta.
Bake until the mozzarella is melted, 5 minutes.
Without removing the skillet from the oven, increase oven temperature to broil; broil until the cheese is golden-brown, 2 to 3 minutes.
Garnish with basil, if desired.
