It's a preposition. The complements of prepositions are most often nouns or noun phrases (e.g. the doorbell rang until midday), but they can also be clauses (e.g. 'I answered it'). Adverbs generally function as modifiers of verbs, and other categories other than nouns.