Preposition is the correct answer.
In the sentence ¨They ate lunch under a pine tree", under is classified as a preposition of place. It's been used to especify the place where the subject "they" had lunch. The word "under" in the sentence can be easily replaced by the words "below" or "beneath" which are also prepositions of place.