Sometimes the spike walls are unavoidable. That's when you have to flip over them. Spin through the wall of spikes, and jump up and away from all of the pits that are hoping to ensnare you. With just the flick of your wrist you can turn a bottomless pit into the top of a hill.
Use X to jump. Press Z to flip the screen and run on the opposite side.