Detect Magic

Prior to patch 2.3, Detect Magic was a Mage spell that allowed the mage (and others) to see the magical buffs on an enemy target. Normally, you could only see debuffs put there by you or others. With the default Blizzard UI, the target's buffs appeared directly below the row of debuffs on the target's unit frame. The Detect Magic debuff placed on the target was dispellable as a magic debuff. The spell caused no threat, and could be cast on enemies without aggroing them, similar to Hunter's Mark.

Tips and tactics
Detect Magic was useful in several PvE encounters where a boss may use a special self buff throughout the fight. Some bosses had a damage shield or a reflective shield that could be dangerous if not detected quickly. While these buffs also usually had a casting animation with them, it was difficult to spot it amongst the visual clutter when many other players were attacking the same target. Detect magic would show the buff clearly on the target's unit frame.

Detect Magic was also good for finding buffs that mages could Spellsteal.

There was no cooldown on this ability (aside from the Universal Cooldown).

This spell had an unusually long range, so it could be used in PvP to cause panic when enemy players saw you casting something from very far away.

Mages often used this spell to mark targets for Polymorph. For example: "The one that just had the swirling, glowing ball around it is the one I will polymorph."

Since it was a debuff, this spell could be dispelled; but you could also use it to "insulate" other debuffs. Debuffs are dispelled in the order they are cast, putting this on an enemy before your Warlock friend casts his curses will make your enemy have to dispel your Detect Magic before he can get to the more harmful effects. Most dispels are instant cast and very cheap, so it's main benefit is the time it takes.

When facing a hostile Warlock with a Felhunter in a one-on-one fight, cast this spell on him before Polymorph, so the Felhunter will have to dispel it (with Devour Magic) first then wait the Cooldown of 8 seconds to dispel your Polymorph. Eight seconds are often priceless in this kind of encounter.

In the RPG
Detect Magic is a divination spell used by healers and arcanists. It allows a caster to detect magical auras. The amount of information revealed depends on how long someone studies a particular area or subject. It can show the presence or absence of magical auras. With further study, it can show the number of different magical auras and the power of the most potent aura. Finally, with enough time, it can give the strength and location of each aura.