Both come from Latin vastare (“to lay to waste”) which in turn comes from vastus (“empty.”)
The v- sound of vastare turned into a gu- sound as Latin turned into Spanish. But in English, this French word took on the more Germanic w- sound. Thus, although not directly descended from German, it does follow the common g-/w- pattern (guerra/war).
We can thus see the g-st map to the w-st clearly.
After all: spending money is wasting money!