tl;dr: The part of speech of mountains is here a noun. It’s the direct object of the verb climbing.
How we know that climbing is a verb, though, is more work. That’s because it might instead be a noun or an adjective. It’s a verb as just mentioned, but let’s look at all three cases just to make sure.
We’ll assume that for parts of speech, your possible choices are one of noun, verb, adjective, or adverb. Parts of speech like conjunction, preposition, determiner, interjection, and such aren’t really relevant here.
Note that parts of speech can only be single words. Things like subject, predicate, and direct object are not parts of speech. They are syntactic constituents, which can be more than one word.
Climbing as an adjective: “climbing roses”
- I like climbing roses.
The word roses is the direct object, and it is here being modified by the adjective climbing. You can tell it’s an adjective not a noun adjunct because it passes the predicate test:
- The roses are climbing (ones). [TRUE]
You know it isn't a verb here because you can't flip to the infinitive without a change in meaning:
- I like to climb roses. [FALSE]
You can also tell it’s not a verb because adding an adverb of manner to one side means something totally different from what you get adding it to the other side:
- I like quickly climbing roses. [adjective meaning]
- I like climbing roses quickly. [verb meaning]
If climbing had been a verb, you would have been able to move quickly without changing the meaning. But you can’t.
Climbing as a noun: “climbing gyms”
- I like climbing gyms.
Here now gyms is the direct object of like, but climbing has now become a noun modifying gyms, not an adjective modifying gyms. You can tell this because it fails the predicate test:
- The gyms are climbing. [FALSE]
Therefore these are gyms that are for climbing, and so climbing is here a noun. You can think of climbing-gyms as a compound noun.
The stress has also shifted.
You know it's a noun because you can add other customary components of a noun phrase like quantifiers and adjectives:
- I like some easy climbing gyms.
Because you can do that, you know it’s not a verb there.
Climbing as a verb: “climbing mountains”
- I like climbing mountains.
The direct object of the verb like is the entire non-finite verb phrase “climbing mountains”, where mountains is in turn the direct object of the non-finite verb climbing. Since only verbs can have direct objects and mountains is the direct object of climbing, that means that climbing must be being used as a verb here.
Verbs not only take objects, they can also take adverbs of manner. So for example:
- I like quickly climbing mountains.
- I like climbing mountains quickly.
Because you can freely move quickly and the two sentences above still mean the same thing, you know that quickly is modifying climbing as a verb. If it were doing so as an adjective, you would not be able to move quickly around like that without shifting the meaning.
In other words, if they had meant different things after adverbial movement, then these would just be mountains that happened to be quickly climbing ones, like quickly climbing roses. But since that’s not what this means, it’s a verb.
Again, the entire verb phrase, not any single word, is the direct object of like, but climbing is clearly a verb because only verbs take direct objects and relocatable adverbs of manner in this fashion.
In this instance, you can be sure it's a verb because you can flip it from the one sort of non-finite verb phrase to the other kind without any change in meaning:
- I like to climb mountains.
- I like to quickly climb mountains.
- I like to climb mountains quickly.
Since that means the same thing, both climbing and to climb are verbs here.
Some posters have suggested that this instance of climbing is a noun. It can’t be, as I’ve just demonstrated that it has a direct object, which only a verb can have.
But if you still aren’t convinced, let’s try to do noun-things to this would-be noun. If it were actually a noun, you would be able to modify it with an adjective like dangerous.
- I like ✻dangerous climbing mountains. [UNGRAMMATICAL]
That shows that climbing is not a noun here, since the result is ungrammatical when you try to add an adjective to it.
It’s a verb. Just a verb: not a noun, not an adjective.
I’m just glad you didn’t ask what climbing was in
- I like climbing climbing mountain roses climbing mountain climbing gyms.
For up that wall climb climbing buffalo climbing. :)