The Spanish Interior Ministry says a small explosive device has detonated in northern Spain along a route used by the Tour of France cycling race.