Gym spots can be challenged for. You must contact a gym leader and let them know you are challenging for their spot. You must use a team of the same type. They have 3 days to accept unless there is a valid reason why they can't. The challenger is given at max 2 challenge battles that the challenged gym leader must accept. After those 2 and the challenger has not taken the spot, the gym leader does not have to accept your challenge.
Addendum by Monkey: If you loose or tie to the gym leader in a Gym Spot Challenge Battle, you must wait 3 day before the next battle, unless the gym leader and the challenger both agree to rebattle earlier. This is to prevent Gym Leaders from getting SPAMed with all of someone's challenges in one day.