Preheat the oven to 350°F (175°C) and lightly grease a baking dish.
Peel and slice the sweet potatoes into even rounds and arrange them in the dish.
In a saucepan, melt the butter and stir in brown sugar, cinnamon, nutmeg, salt, and water. Simmer briefly until combined.
Remove from heat and stir in vanilla extract.
Pour the sauce evenly over the sweet potatoes.
Cover with foil and bake for 40 minutes.
Remove foil, baste the yams with the sauce, and bake uncovered for 25–30 minutes until tender and caramelized.
Add marshmallows during the last 10 minutes of baking if desired.
Serve warm.