The English foot comes from the Indo-European root *ped. Think pedal.
Interestingly, the “p” sound consistently transformed into an “f” in the Germanic languages — but remained a “p” in the Latinate languages.
This is why, foot is equivalent to pie.
Other examples of this pattern include father and padre, and the English far is from the same root as the Latin per.
Father is one of the most basic words in every language and a traceable pattern throughout the Indo-European languages.
The original PIE sound “p-” changed in all the Germanic languages to “f-“. This is referred to as “Grimm’s Law”, from the fairy-tale fabulist who first noted this pattern.
In the Latin languages such as Spanish, the original “p-” sound was preserved. Thus, the Spanish padre’s p-d-r root maps to the English father’s f-th-r root.
The Spanish for “foam”, espuma, comes from the Latin for the same: spuma. And this Latin comes from the Proto-Indo-European root *(s)poi-moi from which we also get the English… foam.
How so? Because the PIE root p- very consistently became an f- as it evolved into German then English, but this transformation never happened when it became Latin and then Spanish. Note words like foot/pie and father/padre.
Thus the f-m of foam maps to the (s)-p-m of espuma very clearly!