Preheat oven to 350 degrees F (175 degrees C). Coat a 9x13-inch casserole dish with cooking spray.
Place sweet potatoes, pineapple, and mandarin oranges in 9x13-inch baking dish, sprinkle coconut on top.
Melt margarine in a small bowl in the microwave, about 10 seconds. Combine melted margarine, brown sugar, vanilla extract, 1 tablespoon pumpkin pie spice, and enough reserved pineapple juice to make 1 cup. Stir sauce until brown sugar is dissolved, about 1 minute. Drizzle sauce over sweet potato mixture, sprinkle remaining 1 tablespoon pumpkin pie spice on top.
Bake in the preheated oven until bubbling, about 1 hour.