The Pyrenean Oak tree (Quercus pyrenaica) is one of the Oak trees that produce "apple" Galls. Galls are round balls (with little horn like bumps - see above), about an inch and a quarter in diameter that "grow" on the new branch growth. There are not, however, a natural part of the tree but rather are the result of the trees defense mechanism against foreign objects.
The galls grow when a wasp lands on the soft bark of a new branch and deposites an egg (or mabye sevaral) into the branch. The tree sensing a foreign object isolates the egg by growing a ball that serves to keep the insect out of the branch. In the picture above you can see both the inside of the gall and a small wasp larvae (at the tip of the knife).
The gall then serves as a protective environment for the wasp larvae as well as a source of food until it is ready to bore its way out of the galls hard outer shell and fly away. The image above shows several of these holes.
The galls on this tree species grow occur in different sizes and some of them do not have the horn like bumps. I´m not sure if these are produced as the result of different insects or not.
The leaves of these trees also seem to have a gall-like defensive mechanism as can be seen in the image above.
Another Oak tree in Spain that produces galls is the Portuguese Oak.