There are several different sizes of spikes available. They range from just about exact scale spikes available from Proto87 Stores to spike-shaped things that would scale out to 6" thick. MicroEngineering makes the smallest spikes after Proto87 Stores, and they come in medium, small, and micro sizes. The Proto87 spikes are also available in several sizes.
From experience with hand laying track, foam doesn't hold spikes at all, and cork isn't very good, either. The preferred materials for spiking into are Homasote, Upson board, sound insulation board, door skin (a thin wood veneer), and Vinylbed. Some have successfully used soft pine and other wood and luaun plywood.
If you mean track nails by the term "spikes", that's a whole 'nother matter. Again, cork doesn't hold very well over the long term, so you need something firmer underneath to drive the track nails into. But because of foam and the desire to avoid hammering on the layout, glued construction has increasingly come into favor. The cork is glued to plywood or foam, and track glued to the cork. Latex caulk and white glue are the most commonly used glues for this purpose.
my thoughts, your choices