There are many things in D&D that are spells, spell-like effects, magical effects, magic-like effects, or otherwise special abilities.

There are also many things that affect such things.

What is actually considered to be a spell though? How do I determine whether something is a spell for the purposes of effects that affect spells?

On page 201 of the PHB it says:

What is a Spell?

A spell is a discrete magical effect, a single shaping of the magical energies that suffuse the multiverse into a specific, limited expression. In casting a spell, a character carefully plucks at the invisible strands of raw magic suffusing the world, pins them in place in a particular pattern, sets them vibrating in a specific way, and then releases them to unleash the desired-in most cases, all in the span of seconds.

But that doesn't really tell us anything from a rules perspective.

Further down the page it says:

Spell level

Every spell has a level from 0 to 9.

So is that the answer? Is something required to have a level from 0 to 9 to be considered a spell or can a magical effect be considered a spell if it doesn't have a level?

\$\begingroup\$So I'm curious if you can think of a case which might be confusing so that I can work through it as an example for my answer. I'm trying to find a case that isn't solved simply by looking it up in a spell list. If you have such a case I think it would help.\$\endgroup\$
– RubiksmooseSep 11 '18 at 15:03

\$\begingroup\$@Rubiksmoose one example could be the changelings change appearance feature which is most likely magic but i would say isn't a spell\$\endgroup\$
– rpgstarSep 12 '18 at 2:54

\$\begingroup\$@Rubiksmoose to be honest my thought was to hopefully have this stand as more of flagship question since we get a lot of other questions asking whether things like class features (e.g. Wild Shape) and the like are spells or something similar. And I wouldn't have been able to put together such an excellent answer as yours. I will try to find a decent example what I get a chance and include it in my question though.\$\endgroup\$
– Purple MonkeySep 12 '18 at 5:17

A spell is called a spell and listed in a spell list

Want to know what spells look like? See "Spells" (PH, 211–89). Nothing else is a spell unless it is presented as a spell or called one.

If you find something and are unsure if it is a spell, first see if there is anything in the description that says it is a spell. If it says that you "cast" it, or that it has a "spell level", or if it is listed under the Spellcasting, Innate Spellcasting or Psionic Spellcasting header in a stat block then it is a spell.1

If there is nothing indicating it is a spell there, look up the name of the ability in question in the resources below. If it's not listed there, it's not a spell. If it is listed there, it is.

Spell lists can be found in the books or online

All spells currently released are listed in the Player's Handbook (Chapter 11), Xanathar's Guide to Everything (Chapter 3), or Elemental Evil Player's Companion (Chapter 2). Each of these chapters is simply called "Spells". The Sword Coast Adventurer's Guide also contains 4 cantrips for sorcerers, warlocks, and wizards; they are listed at the end of the list of classes on p. 142-143.

Examples:

"Spell-like" abilities are not spells

Some abilities look very similar to spells, but if they aren't in a spell list, they aren't spells.

The beholder has the ability Eye Rays with different effects. One of which is:

Charm Ray. The targeted creature must success on a DC 16 Wisdom saving throw or be charmed by the beholder for 1 hour or until the beholder harms the creature.

"Charm Ray" is not found in any of the spell lists nor does anything in the description say it is a spell and thus it is not a spell. It also does not allow for the casting of spells. Thus, we must conclude that "Charm Ray" is not a spell. As such, anything that affects spells will not affect it.

Abilities that allow the casting/effects of spells are not spells (but the spells resulting from them are)

Other abilities let you cast spells. These abilities are not spells in and of themselves, they just allow you to cast spells.

For example, let's look at this Way of the Four Elements Monk ability:

Flames of the Phoenix (11th Level Required). You can spend 4 ki points to cast fireball.

We can determine that the ability flames of the phoenix is not itself a spell by looking up its name in the list of spells. It isn't there therefore it is not a spell. However, the ability description has several clues that tell you that it does involve the casting of the spell. Firstly, it says "cast [name]". Since casting is something that is only done with spells this is going to be a spell. And if you look up fireball in the list of spells you will find it there. Thus, fireball is a spell cast from the ability Flames of the Phoenix which is not a spell. The fireball will be affected by anything an applicable fireball cast by any other method would be.

The same thing applies to something like a potion of heroism which says:

For 1 hour after drinking it, you gain 10 temporary hit points that last for 1 hour. For the same duration, you are under the effect of the bless spell (no concentration required).

The potion is not considered a spell (there is no spell called "potion of heroism" in the spell lists) but it has a spell effect in it. So, you are considered to be under the effects of that spell for all purposes including dispel magic (see this Q&A for more on that).

Something like the potion of water breathing (though also not a spell itself for the same reasons) does not result in a spell being created because nowhere in the description is a spell name listed.

Thanks @Ruse for giving me feedback and advice in putting this together.

1 - One thing to note is that the phrase "spell slot" is not indicative of being a spell. There are many abilities that use spell slots that are not spells (in addition to spells that don't use a spell slot at all). Crawford explicitly says this in this tweet about Divine smite, for example:

Divine smite is not a spell, yet it is fueled by spell slots. Because it is not a spell, it is not affected by things like Rage that prevent spellcasting.

Thus, even if something uses a spell slot or says "spell slot", that is not enough to determine if it is a spell. In this case, simply look up the name of the ability and see if it is in a spell list. That will tell you for sure.