I recently had this problem myself. When I looked into it, it seemed that a number of things can cause it: overfilling the basket, tamping, not tightening the moka pot properly, worn-out rubber seal, etc. It made such a mess that I wasn't in a rush to try it again. However, after reading about your experience I just had another go and it worked perfectly.
-grind 14g of beans in porlex on setting 4 (this turned out to be too much coffee, by about 6g!)
-fill moka pot with boiling water to below the valve
-fill the basket with ground coffee and level off using the back of a butter knife, do not tamp
-spill ground coffee everywhere but catch most of it on the a kitchen plate
-using a tea towel around the bottom, tighten the moka pot as tight as you can
-stick it on the gas hob on full flame but turn it down to the lowest as soon as the coffee starts coming out of the top
-remove the moka pot from the heat as soon as you see/hear a change in the flow and put the bottom in a bowl of cold water
-enjoy your coffee without needing to clean the entire kitchen afterwards
You might struggle with an electric hob but good luck!