In a 9-by-13-inch (23-by-33-cm) baking dish, arrange the sweet potatoes in 2 or 3 layers, overlapping them slightly.
In a medium saucepan over medium heat, melt the butter. Sprinkle in the sugars, cinnamon, nutmeg, cloves, and ginger. Remove from the heat and give the spiced butter a good stir. Add the vanilla and stir to combine.
Pour the mixture over the sweet potatoes and turn to coat them thoroughly. Cover the baking dish with aluminum foil and bake for 30 minutes.
Remove the sweet potatoes from the oven and baste them with the candied mixture in the dish. Cover again and bake until tender, 20 to 40 minutes more.
Remove the sweet potatoes from the oven and let them sit for about 10 minutes. Baste them again with the spiced syrup in the pan before serving.
Notes
Using yams for this recipe--Yams will take slightly longer to cook than sweet potatoes, so I recommend using only one or the other.
Storage and reheating--Store leftover potatoes in a sealed container in the fridge for up to 4 days. Reheat in a covered dish in a 300°F oven until warmed through.